ConfigurationUserLevel Enumeration

Note: This enumeration is new in the .NET Framework version 2.0.

Used to specify which configuration file is to be represented by the Configuration object returned by OpenExeConfiguration.

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

'Declaration
Public Enumeration ConfigurationUserLevel
'Usage
Dim instance As ConfigurationUserLevel

public enum ConfigurationUserLevel
public enum ConfigurationUserLevel

 Member nameDescription
NoneGet the Configuration that applies to all users. 
PerUserRoamingGet the roaming Configuration that applies to the current user. 
PerUserRoamingAndLocalGet the local Configuration that applies to the current user. 

Use ConfigurationUserLevel to specify which configuration file is to be represented by the Configuration object returned by ConfigurationManager.OpenExeConfiguration and System.Configuration.ConfigurationManager.OpenExeConfiguration.

Application configuration files are in the same directory as the application and have the same name, but with a .config extension. For example, the configuration file for C:\System\Public.exe is C:\System\Public.exe.config.

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 following example shows how to use the ConfigurationUserLevel enumeration. This example is part of a larger example to be found at ConfigurationManager.

 ' Modify a custom section. Show how to use the
 ' OpenExeConfiguration(ConfigurationUserLevel) method.
Shared Sub ModifyCustomSection()
   ' Get the application configuration file.
     Dim config As System.Configuration.Configuration = _
     ConfigurationManager.OpenExeConfiguration( _
     ConfigurationUserLevel.None)
   
   Console.WriteLine(config.FilePath)
   
     Dim custSection As CustomSection = _
     config.Sections(customSectionName)
   
   custSection.FileName = "newName.txt"
   custSection.MaxIdleTime = New TimeSpan(0, 15, 0)
   custSection.MaxUsers = custSection.MaxUsers + 10
   
   If Not custSection.ElementInformation.IsLocked Then
      config.Save()
   Else
      Console.WriteLine("Section was locked, could not update.")
   End If
End Sub 'ModifyCustomSection

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: