Sunday, July 12, 2009

Web.config &

I wrote a small ASP.NET application, which needed to read the web.config file. To open the Web.config file I used '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=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

The resolution - use ConfigurationManager.ConnectionStrings instead.

No comments: