Article ID: 320268 - Last Review: March 22, 2007 - Revision: 4.5 "System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NETThis article was previously published under Q320268 On This PageSYMPTOMS When you use a virtual directory that points to a remote
share to host a Microsoft ASP.NET-based application, you may receive an error
message that is similar to one of the following: Message 1 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. Source Error: Line 30: private static bool __intialized = false; Line 31: Line 32: public Global_asax() { Line 33: if ((ASP.Global_asax.__intialized == false)) { Line 34: ASP.Global_asax.__intialized = true; Server Error in '/ApplicationName' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'ApplicationName.Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="ApplicationName.Global" %> Source File: Path of Application \global.asax Line: 1 CAUSE The System.Web namespace does not have the AllowPartiallyTrustedCallersAttribute
applied to it. For more information, visit the following Microsoft Developer
Network (MSDN) Web site: http://msdn2.microsoft.com/en-us/library/ms994923.aspx
(http://msdn2.microsoft.com/en-us/library/ms994923.aspx)
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.
RESOLUTION To resolve this behavior, grant the FullTrust right to the
remote share:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on Note For more information about what these arguments do, run the following command:caspol.exe -? STATUS This
behavior is by design. MORE INFORMATION In this configuration, the account under which the ASP.NET worker
process runs must have sufficient rights to the remote share. You can set
the account under which the worker
process runs by using the Processmodel tag in the Machine.config file. Steps to reproduce the behavior
REFERENCES
For more information about the permissions that the ASPNET account
requires to run ASP.NET applications, click the following article number to view the article in the Microsoft Knowledge Base:
317012
(http://support.microsoft.com/kb/317012/
)
Process and request identity in ASP.NET
For more information about ASP.NET security, click the following article number to view the article in the Microsoft Knowledge Base:
306590
(http://support.microsoft.com/kb/306590/
)
ASP.NET security overview
| Article Translations
|

Back to the top
