Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
OpenMappedExeConfiguration Method (ExeConfigurationFileMap, ConfigurationUserLevel, Boolean)

ConfigurationManager.OpenMappedExeConfiguration Method (ExeConfigurationFileMap, ConfigurationUserLevel, Boolean)

.NET Framework 4.6 and 4.5

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

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

'Declaration
Public Shared Function OpenMappedExeConfiguration ( _
	fileMap As ExeConfigurationFileMap, _
	userLevel As ConfigurationUserLevel, _
	preLoad As Boolean _
) As Configuration

Parameters

fileMap
Type: System.Configuration.ExeConfigurationFileMap

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

userLevel
Type: System.Configuration.ConfigurationUserLevel

The ConfigurationUserLevel object for which you are opening the configuration.

preLoad
Type: System.Boolean

true to preload all section groups and sections; otherwise, false.

Return Value

Type: System.Configuration.Configuration
The configuration object.

ExceptionCondition
ConfigurationErrorsException

A configuration file could not be loaded.

The ConfigurationUserLevel object determines the location of the configuration file that is 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 that is determined by userLevel).

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.

For a code example, see the OpenMappedExeConfiguration overload.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft