FIX: SecurityException for ConfigurationPermission is thrown when running in Medium trust
Tuesday, 26 June 2007
When running smartDBforms.NET in a website with Medium trust level System.Security.SecurityException is thrown. The exception details are: System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
SYMPTOMS
When running smartDBforms.NET in a website with Medium trust level
System.Security.SecurityException is thrown. The exception details are: System.Security.SecurityException:
Request for the permission of type 'System.Configuration.ConfigurationPermission,
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
failed.
CAUSE
Most of shared hosting providers run their websites in Medium trust level.
The Medium trust level can also be set by using the <trust level="Medium"/> tag in <system.web> in Web.config.
When running in Medium trust level the custom Web.config configuration sections
are by default not accessible for the website code. When smartDBforms.NET tries
to read its own smartDBforms.NET configuration section and the
website is in Medium trust level a SecurityException is thrown
RESOLUTION
The problem has been fixed in smartDBforms.NET 1.5 and later. The Visual Studio
templates and the conifguration section creation code now mark the smartDBforms.NET
configuration section as not requiring permission by using the requirePermission="false"
attribute.
WORKAROUND
To fix the problem open the Web.config file and add the requirePermission="false"
attribute to the smartDBforms.NET section declaration. After that the section declaration
should look like this:
<section name="smartDBforms.NET" requirePermission="false" type="Adillis.SmartDBForms.Configuration.SettingsSection, Adillis.SmartDBForms" />
APPLIES TO
smartDBforms.NET 1.4 and previous versions
|