ASP.NET在Medium Trust Level下面的问题

zenoven 2010-12-21 05:25:04
我也是最近才知道Trust Level的问题,所以很菜,现在遇到了两个问题,服务器的 Trust Level是改不了的,现在怎么能解决这两个问题呢?谢谢大家了!

1、一个验证码控件在Medium Trust Level下面不能运行,控件是dll的,
Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.

Source Error:


Line 135: <label>
Line 136: <span class="span" style="float:left;width:153px;">验证码</span>
Line 137: <cc1:AuthCode ID="AuthCode1" runat="server" CssClass="authcode" Height="20px" TextBoxClass="input" TextControlWidth="120px" Width="294px" EnableClientValidate="True" SubmitControlID="submit" IsChangeImageOnPostback="True" />
Line 138: </label>
Line 139: <p>

运行错误截图如下,截图红色那一部分就是用的控件


2、程序对web.config有写操作,但是现在不能执行了,我想大概也是这个。

错误信息如下
Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

...全文
160 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zenoven 2010-12-25
  • 打赏
  • 举报
回复
高手呢。。。来看看有什么解决方案吗?

难道非要换个验证码插件?在medium trust下面就没什么别的解决方案了?

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧