The Configuration class instance represents the merged view of the configuration settings that apply to a specific physical entity, such as a computer, or to a logical entity, such as an application, or a Web site. The specified logical entity can exist on the local computer or on a remote server.
When no configuration file exists for a specified entity, the Configuration object represents the default configuration settings as defined by the Machine.config file.
You can get a Configuration object using one of the open configuration methods as defined by the following classes:
To generate a configuration file representing the inherited configuration settings for a specified entity, use one of the save-configuration methods:
Note: |
|---|
To enable access to configuration settings on a remote computer, use the Aspnet_regiis command-line tool. For more information about this tool, see
ASP.NET IIS Registration Tool (Aspnet_regiis.exe). For information about creating and accessing custom configuration settings other than the intrinsic sections included in the .NET Framework, refer to ConfigurationSection.
|
Notes to Implementers:
The Configuration is the class that allows programmatic access for editing configuration files. You use one of the open methods provided by WebConfigurationManager for Web applications or by ConfigurationManager for client applications. These methods will return a Configuration object, which in turn provides the required methods and properties to handle the underlying configuration files. You can access these files for reading or writing as explained next.
You use GetSection or GetSectionGroup to read configuration information. Note that the user or process that reads must have the following permissions:
If your application needs read-only access to its own configuration, it is recommended you use the GetSection overloaded methods in case of Web applications. Or the GetSection method in case of client applications.
These methods provide access to the cached configuration values for the current application, which has better performance than the Configuration class.
Note: |
|---|
If you use a static
GetSection method that takes a path parameter, the path parameter must refer to the application in which the code is running, otherwise the parameter is ignored and configuration information for the currently-running application is returned.
|
You use one of the Save methods to write configuration information. Note that the user or process that writes must have the following permissions: