.NET Security Exception Error

I’ve been meaning to write a post on this for ages but I’ve always forgotten to take a screenshot until now. If you ever get this error thrown from your .NET application:

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

securityexception

This always means that you need to set your trust level to “Full” in your web.config file in order to correct the problem.  I’ve included the correct XML markup that you need to add/modify in your web.config file below:

< ?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system .web>
    <trust level="Full"></trust>
  </system>
</configuration>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.