• Article for your preferred language does not exist. Below is international version of the article.

Article ID: 124321, created on Jan 28, 2015, last review on Jan 28, 2015

  • Applies to:
  • Plesk Automation

Symptoms

When I open website the following error is displayed:

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 for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

or

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 for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Cause

Current .NET Trust Security level does not allow to ASP.NET application get access to required system resource.

Resolution

Use the .NET Trust Levels feature page to set the trust element in the web.config file. The trust element enables you to configure the level of code access security (CAS) that is applied to an application.

Depending on ASP.NET version in configuration file on Windows service node, set required Trust Level in corresponding configuration file:

  • For ASP.NET 4.0(4.5) C:\Windows\Microsoft.NET\Framework\v4.0.30319:

    <location allowOverride="false">
        <system.web>
            ...
            <trust level="Medium" originUrl="" />
        </system.web>
    </location>
    
  • For ASP.NET 2.0(2.5) C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config:

    <location allowOverride="true">
        <system.web>
            ...
            <trust level="Medium" originUrl="" />
        </system.web>
    </location>
    

Note: It is sever-wide settings. If you need to allow redefine security level on web-site level you should set true value for allowOverride parameter and then define required Trust Level in website web.config file.

For additional information please refer to the article

Search Words

ASP.NET Security level

The application attempted to perform an operation not allowed by the security policy

IIS Security Exception

.NET Trust Levels Page

e0aff7830fa22f92062ee4db78133079 caea8340e2d186a540518d08602aa065

Email subscription for changes to this article
Save as PDF