This topic has not yet been rated - Rate this topic

SectionInformation.RequirePermission Property

Note: This property is new in the .NET Framework version 2.0.

Gets a value indicating whether the associated configuration section requires access permissions.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public bool RequirePermission { get; set; 
/** @property */
public boolean get_RequirePermission ()

/** @property */
public void set_RequirePermission (boolean value)

public function get RequirePermission () : boolean

public function set RequirePermission (value : boolean)

Property Value

true if the requirePermission attribute is set to true; otherwise, false. The default is true.

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 which allow access to configuration section handlers are restricted by the trust level set on the Web application.

NoteNote

Since high and full trust are the only levels which allow access to files outside of the current app domain, an application can only use configuration section handlers 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

The appropriate file ACL (Access Control List) permissions are still required regardless of the RequirePermission setting.

The following example shows two possible trust levels for a Web application when the RequirePermission of the appSettings section is true. When the trust level is set to full the two lines of code shown next work otherwise they fail.

<system.web>
   // With the following trust value 
   // the code below works.
  <trust level="Full" />
</system.web>

<system.web>
  // With the following trust value 
  // the code below does not work
  <trust level="Medium" />
</system.web>

WebConfigurationManager.GetSection("appSettings");
WebConfigurationManager.AppSettings;

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ