Udostępnij za pośrednictwem


Configuration Section Settings

A configuration file can also contain information that the application reads at run time. Developers use configuration sections to specify this information in configuration files. The .NET Framework provides several predefined configuration sections and developers can also create custom configuration sections.

Configuration sections have two parts: a configuration section declaration and the configuration settings. You can put configuration section declarations and configuration settings in the machine configuration file or in the application configuration file.

At run time, section handlers, which are classes that implement the IConfigurationSectionHandler interface, read settings in the machine configuration file first, followed by the application configuration file. Depending on the section handler, either the settings in the application file override the settings in the machine file or the settings from both files are merged.

Note   ASP.NET applications have configuration files at the application and directory levels. You can put configuration section settings in ASP.NET configuration files (Web.config) at either level. For more information, see ASP.NET Configuration.

This section describes how to declare configuration sections and access configuration settings.

In This Section