System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration Method

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

Syntax

public static System.Configuration.Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, string userName, string password)

Parameters

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

Returns

A System.Configuration.Configuration object.

Remarks

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

To obtain the System.Configuration.Configuration 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.

Requirements

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