Click here to Skip to main content
16,004,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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



Please give me help for that. Without using of Validator page is running sucessfully
Posted
Updated 7-Jun-10 4:59am
v2
Comments
Jamil Hallal 7-Jun-10 9:34am    
Can you post the code of your validator?

Hi,

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

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

Thanks
 
Share this answer
 
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,
 
Share this answer
 
<system.web><trust level="Full">

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900