maxyfc
maxyfc

Reputation: 11337

Purpose of requirePermission attribute (web.config)

What does the requirePermission attribute in the <section> element do?

For example:

<configuration> 
  <configSections> 
    <section name="urlrewritingnet"   
             restartOnExternalChanges="true" 
             requirePermission ="false"  
             type="UrlRewritingNet.Configuration.UrlRewriteSection, 
                   UrlRewritingNet.UrlRewriter" /> 
  </configSections> 
</configuration>

There is no mention of this attribute in the official documention. But, seems to be used in a lot of places.

Upvotes: 11

Views: 6188

Answers (2)

DeepSpace101
DeepSpace101

Reputation: 13732

I'm actually going to quote the documentation just in case that page disappears as part of MSDN cleanup.

When RequirePermission is set to true, the GetSection methods are restricted by the trust level setting of the application. This means that methods or properties that allow access to configuration section handlers are restricted by the trust level set for the Web application. NoteNote

NOTE: Because high and full trust are the only levels that allow access to files outside the current application domain, an application can use configuration section handlers only at these trust levels.

When RequirePermission is set to false, the access to the configuration data is not restricted by the application's trust level settings. NoteNote

NOTE: The appropriate file ACL (Access Control List) permissions are still required, regardless of the RequirePermission setting. ACL permissions determine who can access the configuration file.

Upvotes: 8

Nicole Calinoiu
Nicole Calinoiu

Reputation: 21002

The behaviour resulting from this setting is documented at http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.requirepermission.aspx.

Upvotes: 12

Related Questions