System.Web 2.0.0.0 System.Object

The class allows you to access computer and application information.

Using is the preferred way to work with configuration files related to Web applications. For client applications, use the class.

Your application can extend the types or use them directly to handle configuration information, as explained in the following list:

Handling configuration. To handle configuration information using the standard types, you use one of the following approaches:

Accessing a section. To access configuration information for your application, you must use one of the GetSection methods provided by . For <appSettings> and <connectionStrings>, you use the and properties. These methods perform read-only operations, use a single cached instance of the configuration, and are multithread aware.

Accessing configuration files. Your application can read and write configuration settings at any level, for itself or for other applications or computers, locally or remotely. You use one of the open methods provided by . These methods will return a object, which in turn provides the required methods and properties to handle the underlying configuration files. These methods perform read or write operations and recreate the configuration data every time a file is opened.

Advanced configuration. More advanced configuration handling is provided by the types , , , , , , and .

Extending configuration standard types. You can also provide your custom configuration elements by extending the standard configuration types such as , , , and by using a programmatic or an attributed model. Refer to the class for an example of how to extend a standard configuration type programmatically. Refer to the class for an example of how to extend a standard configuration type using the attributed model.

Provides access to configuration files as they apply to Web applications.

- Property
  System.Collections.Specialized.NameValueCollection To be added.

  An object contains the configuration file's <appSettings> section.

  Gets the Web site's application settings.

  2.0.0.0
- Property
  System.Configuration.ConnectionStringSettingsCollection To be added. To be added.

  Gets the Web site's connection strings.

  2.0.0.0
- Method
  System.Object ``

  If 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.

  If your application uses a different protocol than HTTP, the overload that takes both a section name and a path in its parameter list is the one to use. You must specify the configuration file path because the system cannot make any assumptions about the configuration hierarchy level. If you use the overload that takes only a section name, the system will always attempt to return the configuration settings at the application level. Note, though, that if its specified path is outside of the current application, the overload that takes a path will also return the application-level configuration settings for the currently running application.

  You could call 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.

  The method is a run-time method that operates on the section of a configuration file at the hierarchy level in which the application runs. For a non-run-time operation, use instead. This method operates on the specified section of a configuration file that you obtain using one of the overloaded methods for opening a configuration file, .

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

  The specified configuration section object, or null if the section does not exist. Remember that security restrictions exist on the use of as a runtime operation. You might not be able to access a section at run time for modifications, for example.

  The configuration section name. 2.0.0.0
- Method
  System.Object `` ``

  If is called from within a Web application, it gets the section from the configuration file defined by the specified path in the configuration hierarchy.

  If your application uses a different protocol than HTTP, the overload that takes both a section name and a path in its parameter list is the one to use. You must specify the configuration file path because the system cannot make any assumptions about the configuration hierarchy level. If you use the overload that takes only a section name, the system will always attempt to return the configuration settings at the application level. Note, though, that if its specified path is outside of the current application, the overload that takes a path will also return the application-level configuration settings for the currently running application.

  This method cannot be called from within a client application.

  If you want to retrieve the configuration section from the configuration file located at the current Web application directory level, use the method.

  The method is a run-time method operating on the section of a configuration file at the hierarchy level in which the application runs. For a non-run-time operation, use instead. This method operates on the specified section of a configuration file that you obtain using one of the open configuration file methods.

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

  The specified configuration section object, or null if the section does not exist. Remember that security restrictions exist on the use of as a run-time operation. You might not be able to access a section at run time for modifications, for instance.

  The configuration section name. The virtual configuration file path. 2.0.0.0
- Method
  System.Object ``

  If 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 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.

  The method is a run-time operation that acts on the section of the application configuration file located at the current level. The 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.

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

  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.

  The configuration section name. 2.0.0.0
- Method
  System.Configuration.Configuration

  The method opens the machine-configuration file on the computer where the application runs. This file is located in the standard build directory %windir%\Microsoft.NET\Framework\version\config.

  Opens the machine-configuration file on the current computer as a object to allow read or write operations.

  A object.

  2.0.0.0
- Method
  System.Configuration.Configuration ``

  This method opens the machine-configuration file that is applicable to the directory specified by the parameter.

  Opens the machine-configuration file on the current computer as a object to allow read or write operations.

  A object.

  The application path to which the machine configuration applies. 2.0.0.0
- Method
  System.Configuration.Configuration `` ``

  This method opens the machine-configuration file that is located in the directory specified by the parameter and on the computer specified by the parameter.

  Opens the specified machine-configuration file on the specified server as a object to allow read or write operations.

  A object.

  The application path to which the configuration applies. The fully qualified name of the server to return the configuration for. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` ``

  This method is used to access a configuration file using impersonation.

  The account token is usually retrieved from an instance of the class or through a call to unmanaged code, such as a call to the Win32 API LogonUser. For more information about calls to unmanaged code, see Consuming Unmanaged DLL Functions.

  Opens the specified machine-configuration file on the specified server as a object, using the specified security context to allow read or write operations.

  A object.

  The application path to which the configuration applies. The fully qualified name of the server to return the configuration for. An account token to use. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` `` ``

  This method is used to access a configuration file using impersonation.

  Opens the specified machine-configuration file on the specified server as a object, using the specified security context to allow read or write operations.

  A object.

  The application path to which the configuration applies. The fully qualified name of the server to return the configuration for. The full user name (Domain\User) to use when opening the file. The password for the user name. 2.0.0.0
- Method
  System.Configuration.Configuration `` To be added.

  Opens the machine-configuration file as a object, using the specified file mapping to allow read or write operations.

  A object.

  The object to use in place of the default machine-configuration file. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` To be added.

  Opens the machine-configuration file as a object using the specified file mapping and location to allow read or write operations.

  A object.

  The object to use in place of a default machine-configuration file. The specific resource to which the configuration applies. 2.0.0.0
- Method
  System.Configuration.Configuration `` ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the specified Web-application configuration file as a object using the specified file mapping and virtual path to allow read or write operations.

  A object.

  The object to use in place of a default Web-application configuration file. The virtual path to the configuration file. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the specified Web application configuration file as a object using the specified file mapping, virtual path, and site name to allow read or write operations.

  A object.

  The object to use in place of a default Web-application configuration-file mapping. The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` `` ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the specified Web-application configuration file as a object using the specified file mapping, virtual path, site name, and location to allow read or write operations.

  A object.

  The object to use in place of a default Web-application configuration-file mapping. The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. The specific resource to which the configuration applies. 2.0.0.0
- Method
  System.Configuration.Configuration ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the Web-application configuration file as a object using the specified virtual path to allow read or write operations.

  A object.

  The virtual path to the configuration file. If null, the root Web.config file is opened. 2.0.0.0
- Method
  System.Configuration.Configuration `` ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the Web-application configuration file as a object using the specified virtual path and site name to allow read or write operations.

  A object.

  The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` ``

  To obtain the object for a resource, your code must have read privileges on all the configuration files from which it inherits settings. To update a configuration file, your code must additionally have write privileges for both the configuration file and the directory in which it exists.

  Opens the Web-application configuration file as a object using the specified virtual path, site name, and location to allow read or write operations.

  A object.

  The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. The specific resource to which the configuration applies. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` `` ``

  To obtain the object for a remote resource, your code must have administrative privileges on the remote computer.

  Opens the Web-application configuration file as a object using the specified virtual path, site name, location, and server to allow read or write operations.

  A object.

  The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. The specific resource to which the configuration applies. The network name of the server the Web application resides on. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` `` `` ``

  This method is used to access a configuration file using impersonation.

  The account token is usually retrieved from an instance of the class or through a call to unmanaged code, such as a call to the Win32 API LogonUser. For more information about calls to unmanaged code, see Consuming Unmanaged DLL Functions.

  To obtain the object for a remote resource, your code must have administrative privileges on the remote computer.

  Opens the Web-application configuration file as a object using the specified virtual path, site name, location, server, and security context to allow read or write operations.

  A object.

  The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. The specific resource to which the configuration applies. The network name of the server the Web application resides on. An account token to use. 2.0.0.0
- Method
  System.Configuration.Configuration `` `` `` `` `` ``

  This method is used to access a configuration file using impersonation.

  To obtain the object for a remote resource, your code must have administrative privileges on the remote computer.

  You might need to run the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) with the -config+ option to enable access to the configuration files on the remote computer.

  Opens the Web-application configuration file as a object using the specified virtual path, site name, location, server, and security context to allow read or write operations.

  A object.

  The virtual path to the configuration file. The name of the application Web site, as displayed in Internet Information Services (IIS) configuration. The specific resource to which the configuration applies. The network name of the server the Web application resides on. The full user name (Domain\User) to use when opening the file. The password for the user name. 2.0.0.0