Knowledge Base
smartDBforms.NET for ASP.NET 2
 
 
Knowledge Base Forum
Search knowledge base:

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

 


Page Options: format for printing  Format for Printer

How would you rate the quality of this content?
Poor - - Excellent
Comments? 
Overall Rating: No ratings available.
Comments Left:
Left on Saturday, 26 April 2008 by Anonymous
Comments:
No ratings available.
Copyright 2006-2008 Adillis Terms Of Use Feedback Contact Us