Sunday, July 12, 2009

Web.config & GoDaddy.com

I wrote a small ASP.NET application, which needed to read the web.config file. To open the Web.config file I used 'OpenWebConfiguration':
WebConfigurationManager.OpenWebConfiguration(...)

Since GoDaddy uses medium trust, I kept on getting:
'The application attempted to perform an operation not allowed by the security policy'

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

The resolution - use ConfigurationManager.ConnectionStrings instead.

No comments: