Solved: “Application trust level” error on ASP.NET pages

You may come across this error when you run your ASP.NET application first time:

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

ASP.NET trust level error
ASP.NET trust level error

Solution

All about permissions. You need to grant required permissions to your application. To do this, simply add the code below into your web.config file.

<system.web>
     <securityPolicy>
          <trustLevel name="Full" policyFile="internal"/>
     </securityPolicy>
     <trust level="Full" originUrl=""/>
</system.web>

For more info:
http://technet.microsoft.com/en-us/library/cc753658(v=ws.10).aspx

One thought on “Solved: “Application trust level” error on ASP.NET pages

Leave a Reply