Showing posts from July, 2011

"System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NET

Very recently I have faced a problem when hosting a web application in hosting server. This application is running perfectly on local PC but security exceptions occurs when hosting to a server.

I have got the following error message:

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: Security error.
After consult with senior guys they refer the solution which is sharing with you.

Main Cause

The System.Web namespace does not have the AllowPartiallyTrustedCallersAttribute applied to it.

Any code that is not in the My_Computer_Zone code group that does not have this attribute requires the FullTrust user right. Therefore, the remote share that holds the Web applications content requires FullTrust.