Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Contains a configuration section declaration.
<configuration>
<configSections>
<section>
<configuration>
<configSections>
<sectionGroup>
<section>
<section
name="section name"
type="configuration section handler class, assembly"
allowDefinition="Everywhere|MachineOnly|MachineToApplication"
allowLocation="true|false" />
Attribute | Description |
---|---|
name | Specifies the name of the configuration section. |
type | Specifies the name of the configuration section handler class that reads the section from the configuration file. |
The following attributes are applicable only for ASP.NET applications. The configuration system ignores these attributes when other types of applications are running.
Attribute | Description |
---|---|
allowDefinition | Specifies which configuration file the section can be used in. Use one of the following values:
|
allowLocation | Determines whether the section can be used within the <location> element. Use one of the following values:
|
Declaring a configuration section essentially defines a new element for the configuration file. The new element contains settings that a configuration section handler (that is, a class that implements the IConfigurationSectionHandler Interface) reads. The attributes and child elements of a section you define depend on the section handler you use to read your settings.
Declaring a configuration section handler in the Machine.config file enables you to use the configuration section in any application configuration file on that computer, unless the allowDefinition attribute specifies otherwise.
The following example shows how to define a configuration section and define settings for that section.
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler"
allowLocation="false"/>
</configSections>
<sampleSection setting1="Value1" setting2="value two"
setting3="third value" />
</configuration>
This element can be used in the application configuration file, machine configuration file (Machine.config), and Web.config files that are not at the application directory level.
Custom Element for NameValueSectionHandler and DictionarySectionHandler | Custom Element for SingleTagSectionHandler | Configuration Section Settings | <sectionGroup> Element | Configuration Sections Schema