Security Exception, ConfigurationPermission Error ...

Problem

You get this error when running your 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 for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

Running under medium trust level in .NET

This condition frequently arises when hosting providers (ASPs) run under the .NET framework’s “medium trust”.  Your application may be referencing a dll file that requires full trust, as explained earlier in the documentation. If that is the case, then you have a choice of removing any reference to the dll from your application, or changing your environment to allow Full Trust. An example of this is an application configured for security that uses the ForgotUser page configured with a recaptcha control. This control requires Full Trust, so you can either remove it from your application, or change your environment to allow Full Trust.

In applications using the Microsoft .NET 2.0 framework, the application could be attempting to use Ajax extensions but does not have access to System.Web.extensions.dll.  The suggested solution for this exception is to migrate the Iron Speed Designer application from Microsoft .NET Framework 2.0 to 3.5.  An alternative is to disable Ajax extensions in the application using the Application Wizard Options.  You can also ask your hosting provider to place System.Web.extensions.dll in the Global Assembly Cache.

Other Security Exceptions: System.Security.Permissions.FileIOPermission

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

This error can occur when the application is running in medium trust but not all of the files needed are located inside the application’s folder.  Modify your application to locate temporary files, such as those for PDF reports and Microsoft Word reports, into your application’s folder.

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages

Setting the .NET Trust Level for your Application