ConfigurationManager::OpenExeConfiguration Method (ConfigurationUserLevel)
Opens the configuration file for the current application as a Configuration object.
Assembly: System.Configuration (in System.Configuration.dll)
Parameters
- userLevel
-
Type:
System.Configuration::ConfigurationUserLevel
The ConfigurationUserLevel for which you are opening the configuration.
| Exception | Condition |
|---|---|
| ConfigurationErrorsException | A configuration file could not be loaded. |
Client applications use a global configuration that applies to all users, separate configurations that apply to individual users, and configurations that apply to roaming users. The userLevel parameter determines the location of the configuration file being opened by indicating whether it 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 the user level).
Specify which configuration to get by passing one of the following values for userLevel:
To get the Configuration object that applies to all users, set userLevel to None.
To get the local Configuration object that applies to the current user, set userLevel to PerUserRoamingAndLocal.
To get the roaming Configuration object that applies to the current user, set userLevel to PerUserRoaming.
Note To get 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.
Available since 2.0