我也是最近才知道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.