System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection Method

Retrieves the specified configuration section from the current Web application's configuration file.

Syntax

public static object GetWebApplicationSection (string sectionName)

Parameters

sectionName
The configuration section name.

Returns

The specified configuration section object, or null if the section does not exist, or an internal object if the section is not accessible at run time.

Remarks

If WebConfigurationManager.GetWebApplicationSection(string) is called from within a Web application, it gets the section from the configuration file selected by the system according to the Web-application configuration hierarchy.

You could call WebConfigurationManager.GetWebApplicationSection(string) from within a client application. In this case, it gets the default section from the configuration file selected by the system according to the client configuration hierarchy. Usually, this is the Machine.config file, unless you have a mapped configuration in place. For mapping configuration files, refer to the mapping methods described next.

Note:

The WebConfigurationManager.GetWebApplicationSection(string) method is a run-time operation that acts on the section of the application configuration file located at the current level. The System.Configuration.Configuration.GetSection(string) method, however, is not a run-time operation but acts on the specified section obtained through one of the methods for opening the configuration files.

Requirements

Namespace: System.Web.Configuration
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0