Security Exception (The application attempted to perform an operation not allowed by the security policy) )

Code_Worm picture Code_Worm · Apr 12, 2015 · Viewed 39.8k times · Source

we're having as issue with the following security exception when we attempt to open our admin login page.

 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 failed.

first of all we use membership for user authentication operations we have two separate application one for admin one for user each of which has their own Web.Config file.

The user data uploads in wwwroot but admin data uploads in wwwroot/admin and in admin webconfig we define Login.aspx as default page for admin (when user enter mysite.com/admin) and we've created a virtual directory for admin (since we have two Web.Config files) named /admin with path mysite.com/wwwroot/admin

the funny thing is that we use same methods (with the same membership and web.config and also same host) in some other projects but they're working well and the mentioned problem appears from time to time in some of our project(not always occurs) event though all the setting and infrastructures (for all the projects) are the same.

we also have app_Webreference Folder for some of our web services which might be the cause of problem but i'm not sure.We attempted to change the security trust level but the host doesn't let us do so and if it was from host so why wouldn't we have this problem with some other sites of ours so currently I have no Idea what seems to be the problem but it's really problematic please help me

thanks a lot

Answer

Anjan Kant picture Anjan Kant · Dec 19, 2016

Me also helped, just added few lines in web.config to allow full trust level in my web application.

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