ASP.Net Validator中的安全异常 [英] Security Exception in ASP.Net Validator

查看:108
本文介绍了ASP.Net Validator中的安全异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp.net验证程序,例如RequiredFieldValidattor,RegularExpre ....它正在我的系统上运行.但是当我将网站上传到托管服务器时,它会引发安全异常.
安全异常的错误消息是:

I am using asp.net validators like RequiredFieldValidattor, RegularExpre... . It is working on my system. but when I upload my site on to the hosting server then it is throwing Security Exception.
The Error Message of Security Exception is :

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.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Request for the permission of type ''System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase) +118
   System.Reflection.Assembly.get_CodeBase() +35
   System.Web.Handlers.ScriptResourceHandler.GetCodeBaseWithAssert(Assembly assembly) +31
   System.Web.Handlers.ScriptResourceHandler.GetLastWriteTime(Assembly assembly) +36
   System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfoInternal(Assembly assembly) +61
   System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfo(Assembly assembly) +62
   System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +325
   System.Web.Handlers.ScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +33
   System.Web.UI.ScriptManager.GetScriptResourceUrl(String resourceName, Assembly assembly) +89
   System.Web.UI.ScriptRegistrationManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +111
   System.Web.UI.ScriptManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +9




请给我帮助.未使用Validator页面成功运行




Please give me help for that. Without using of Validator page is running sucessfully

推荐答案



使用web.config的system.web部分下的以下配置

< system.web><信任级别="Full"/></system.web>

谢谢
Hi,

Use the configuration below under system.web section of web.config

<system.web><trust level="Full"/></system.web>

Thanks


您好

您可以尝试以下
在web.config中添加条目,其中提到信任级别为完整.

<trust level="Full" originUrl="" />

如果它对您不起作用,请参阅此处,其中讨论了很多有关此异常和可能的可接受解决方案的信息,

http://social.msdn.microsoft.com/论坛/en-US/asmxandxml/thread/b1db5b9f-50a4-4a21-aba1-afeb30957efd [
Hi

You might try with following
Add in entry in web.config mentioning trust level as full.

<trust level="Full" originUrl="" />

If it does not work for you please refer here which discusses a lot for this exception and possible accepted solution,

http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b1db5b9f-50a4-4a21-aba1-afeb30957efd[http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b1db5b9f-50a4-4a21-aba1-afeb30957efd]

Hope that helps,


< system.web><信任级别="Full">

我已添加但没有解决方案...使用System.IO时也出现错误
<system.web><trust level="Full">

i have added but no solution... i also getting error when i am using System.IO


这篇关于ASP.Net Validator中的安全异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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