ConfigurationManager::OpenMappedExeConfiguration Method (ExeConfigurationFileMap^, ConfigurationUserLevel)

 

Opens the specified client configuration file as a Configuration object that uses the specified file mapping and user level.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public:
static Configuration^ OpenMappedExeConfiguration(
	ExeConfigurationFileMap^ fileMap,
	ConfigurationUserLevel userLevel
)

Parameters

fileMap
Type: System.Configuration::ExeConfigurationFileMap^

An ExeConfigurationFileMap object that references configuration file to use instead of the application default configuration file.

userLevel
Type: System.Configuration::ConfigurationUserLevel

The ConfigurationUserLevel object for which you are opening the configuration.

Return Value

Type: System.Configuration::Configuration^

The configuration object.

Exception Condition
ConfigurationErrorsException

A configuration file could not be loaded.

The ConfigurationUserLevel object determines the location of the configuration file being opened. It indicates whether the file has no user level (the configuration file is in the same directory as the application) or has a per-user level (the configuration file is in an application settings path determined by userLevel).

System_CAPS_noteNote

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

The following code example shows how to use the OpenMappedExeConfiguration method to obtain all sections that are contained by the configuration file.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: