Security.Permissions.FileIOPermission错误而使用Server.Execute [英] Security.Permissions.FileIOPermission Error while Server.Execute

查看:181
本文介绍了Security.Permissions.FileIOPermission错误而使用Server.Execute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string reportUrl = "/REPORTFOLDER/Report1.aspx?ID=" + transId + "&REF=sundraw";
StringWriter sw = new StringWriter();      

HttpContext.Current.Server.Execute(reportUrl, sw, false);

最后一行在上面code抛出一个Security.Permissions.FileIOPermission错误,
没有发生的本地服务器中,仅在执行从共享托管服务器[GODADDY]

LAST LINE IN THE ABOVE CODE THROWS AN Security.Permissions.FileIOPermission Error, NOT HAPPENING IN THE LOCAL SERVER, ONLY WHILE EXECUTING FROM SHARED HOSTING SERVER[GODADDY]

下图显示是错误讯息


任何帮助或提示AP preCIATED。

ANY HELP OR HINT APPRECIATED.

感谢

推荐答案

很长一段时间的研究,终于找到了解决办法。

Long time research and finally found the solution.

基本上,错误是因为信任级别的。

Basically, the error was because of the TRUST level.

第1步:添加信任的信任级别全部为web.config中

Step 1: added trust trust level Full to web.config

<trust level="Full" />

第二步:会导致另一个错误,无效标记

Step 2: leads to another error, invalid token

这是因为在Go-爸爸ASP.NET 2.0 / 3.0 / 3.5只能有中等信任。不能使用web.config中被覆​​盖到的完全信任。

This is because in go-daddy "ASP.NET 2.0/3.0/3.5" can have only medium trust. can't be override to Full trust using web.config.

请参考: ASP.NET运行时可以使用哪些信任级别?
&安培;
<一href=\"http://support.godaddy.com/help/article/3430/disabling-windows-custom-error-messaging?locale=en&ci=46061\"相对=nofollow>禁用Windows自定义错误消息

因此​​改变了ASP.NET 2.0 / 3.0 / 3.5到ASP.NET 4.0 / 4.5

so changed "ASP.NET 2.0/3.0/3.5" to "ASP.NET 4.0/4.5"

第三步:会导致另一个错误,500内部错误

Step 3: leads to another error, "500, Internal Error".

究其原因, configSections 已经美元的machine.config中p $ psent,所以我们没有在web.config中再次指定
请参阅:迁移网站从ASP.NET 3.2到ASP.NET 4

Reason, configSections are already present in your machine.config, so we don't have to specify again in the web.config Refer: Migrating web site from ASP.NET 3.2 to ASP.NET 4

共解决了我的问题。

这篇关于Security.Permissions.FileIOPermission错误而使用Server.Execute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆