Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
ConfigurationManager Class

Provides access to configuration files for client applications. This class cannot be inherited.

Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Visual Basic (Declaration)
Public NotInheritable Class ConfigurationManager
Visual Basic (Usage)
You do not need to declare an instance of a static class in order to access its members.
C#
public static class ConfigurationManager
Visual C++
public ref class ConfigurationManager abstract sealed
JScript
public final class ConfigurationManager

The ConfigurationManager class enables you to access machine, application, and user configuration information. This class replaces the ConfigurationSettings class, which is deprecated.

NoteNote:

The name and location of the application configuration file depend on the application's host. For more information, see Application Configuration Files.

You can use the built-in System.Configuration types or derive from them to handle configuration information. By using these types, you can work directly with configuration information and you can extend configuration files to include custom information.

The ConfigurationManager class includes members that enable you to perform the following tasks:

Notes to Implementers:

The Configuration class enables programmatic access for editing configuration files. You use one of the Open methods provided by ConfigurationManager. These methods return a Configuration object, which in turn provides the required methods and properties to handle the underlying configuration files. You can access these files for reading or writing.

To read the configuration files, use GetSection or GetSectionGroup to read configuration information. The user or process that reads must have the following permissions:

  • Read permission on the configuration file at the current configuration hierarchy level.

  • Read permissions on all the parent configuration files.

If your application needs read-only access to its own configuration, we recommend that you use the GetSection method. This method provides access to the cached configuration values for the current application, which has better performance than the Configuration class.

To write to the configuration files, use one of the Save methods. The user or process that writes must have the following permissions:

  • Write permission on the configuration file and directory at the current configuration hierarchy level.

  • Read permissions on all the configuration files.

The following example shows how to use the ConfigurationManager class in a console application. The code shows the following:

  • How to access the appSettings configuration section. If the section does not exist, it is created and added to the configuration file. The example creates the application configuration file if one does not exist.

  • How to access the Machine.config file to obtain information such as the default connection string, if it is defined, and the sections that are currently configured.

    NoteNote:

    When you create a project, make sure to add a reference to the System.Configuration assembly. This assembly contains the ConfigurationManager class.

Visual Basic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Configuration
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Diagnostics

' The following example shows how to use the ConfigurationManager 
' class in a console application.
'
' IMPORTANT: To compile this example, you must add to the project 
' a reference to the System.Configuration assembly.
'
Namespace Samples.Aspnet
#Region "AuxliaryClasses"

    '*** Auxiliary Classes ***//

    ' Define a custom configuration element to be 
    ' contained by the ConsoleSection. This element 
    ' stores background and foreground colors that
    ' the application applies to the console window.
    Public Class ConsoleConfigElement
        Inherits ConfigurationElement
        ' Create the element.
        Public Sub New()
        End Sub

        ' Create the element.
        Public Sub New(ByVal fColor As ConsoleColor, _
                       ByVal bColor As ConsoleColor)
            ForegroundColor = fColor
            BackgroundColor = bColor
        End Sub

        ' Get or set the console background color.
        <ConfigurationProperty("background", _
                               DefaultValue:=ConsoleColor.Black, _
                               IsRequired:=False)> _
        Public Property BackgroundColor() As ConsoleColor
            Get
                Return DirectCast(Me("background"), ConsoleColor)
            End Get
            Set(ByVal value As ConsoleColor)
                Me("background") = value
            End Set
        End Property

        ' Get or set the console foreground color.
        <ConfigurationProperty("foreground", _
                               DefaultValue:=ConsoleColor.White, _
                               IsRequired:=False)> _
        Public Property ForegroundColor() As ConsoleColor
            Get
                Return DirectCast(Me("foreground"), ConsoleColor)
            End Get
            Set(ByVal value As ConsoleColor)
                Me("foreground") = value
            End Set
        End Property
    End Class

    ' Define a custom section that is used by the application
    ' to create custom configuration sections at the specified 
    ' level in the configuration hierarchy that is in the 
    ' proper configuration file.
    ' This enables the the user that has the proper access 
    ' rights, to make changes to the configuration files.
    Public Class ConsoleSection
        Inherits ConfigurationSection
        ' Create a configuration section.
        Public Sub New()
        End Sub

        ' Set or get the ConsoleElement. 
        <ConfigurationProperty("consoleElement")> _
        Public Property ConsoleElement() As  _
            ConsoleConfigElement
            Get
                Return (DirectCast(Me("consoleElement"),  _
                        ConsoleConfigElement))
            End Get
            Set(ByVal value As ConsoleConfigElement)
                Me("consoleElement") = value
            End Set
        End Property
    End Class
#End Region

#Region "ManagerInteractionClass"

    '*** ConfigurationManager Interaction Class ***//

    ' The following code uses the ConfigurationManager class to 
    ' perform the following tasks:
    ' 1) Get the application roaming configuration file.
    ' 2) Get the application configuration file.
    ' 3) Access a specified configuration file through mapping.
    ' 4) Access the machine configuration file through mapping. 
    ' 5) Read a specified configuration section.
    ' 6) Read the connectionStrings section.
    ' 7) Read or write the appSettings section.
    Public Class UsingConfigurationManager

        ' Get the roaming configuration file associated 
        ' with the application.
        ' This function uses the OpenExeConfiguration(
        ' ConfigurationUserLevel userLevel) method to 
        ' get the configuration file.
        ' It also creates a custom ConsoleSection and 
        ' sets its ConsoleEment BackgroundColor and
        ' ForegroundColor properties to blue and yellow
        ' respectively. Then it uses these properties to
        ' set the console colors.  
        Public Shared Sub GetRoamingConfiguration()
            ' Define the custom section to add to the
            ' configuration file.
            Dim sectionName As String = "consoleSection"
            Dim currentSection As ConsoleSection = Nothing

            ' Get the roaming configuration 
            ' that applies to the current user.
            Dim roamingConfig As Configuration = _
            ConfigurationManager.OpenExeConfiguration( _
                ConfigurationUserLevel.PerUserRoaming)

            ' Map the roaming configuration file. This
            ' enables the application to access 
            ' the configuration file using the
            ' System.Configuration.Configuration class
            Dim configFileMap As New ExeConfigurationFileMap()
            configFileMap.ExeConfigFilename = _
                roamingConfig.FilePath

            ' Get the mapped configuration file.
            Dim config As Configuration = _
                ConfigurationManager.OpenMappedExeConfiguration( _
                    configFileMap, ConfigurationUserLevel.None)

            Try
                currentSection = DirectCast( _
                    config.GetSection(sectionName),  _
                    ConsoleSection)

                ' Synchronize the application configuration
                ' if needed. The following two steps seem
                ' to solve some out of synch issues 
                ' between roaming and default
                ' configuration.
                config.Save(ConfigurationSaveMode.Modified)

                ' Force a reload of the changed section, 
                ' if needed. This makes the new values available 
                ' for reading.
                ConfigurationManager.RefreshSection(sectionName)

                If currentSection Is Nothing Then
                    ' Create a custom configuration section.
                    currentSection = New ConsoleSection()

                    ' Define where in the configuration file 
                    ' hierarchy the associated 
                    ' configuration section can be declared.
                    ' The following assignment assures that 
                    ' the configuration information can be 
                    ' defined in the user.config file in the 
                    ' roaming user directory. 
                    currentSection.SectionInformation. _
                    AllowExeDefinition = _
                        ConfigurationAllowExeDefinition. _
                        MachineToLocalUser

                    ' Allow the configuration section to be 
                    ' overridden by lower-level configuration 
                    ' files.
                    ' This means that lower-level files can 
                    ' contain()the section (use the same name) 
                    ' and assign different values to it as 
                    ' done by the function 
                    ' GetApplicationConfiguration() in this
                    ' example.
                    currentSection.SectionInformation. _
                        AllowOverride = True

                    ' Store console settings for roaming users.
                    currentSection.ConsoleElement. _
                    BackgroundColor = ConsoleColor.Blue
                    currentSection.ConsoleElement. _
                    ForegroundColor = ConsoleColor.Yellow

                    ' Add configuration information to 
                    ' the configuration file.
                    config.Sections.Add(sectionName, _
                        currentSection)
                    config.Save(ConfigurationSaveMode.Modified)
                    ' Force a reload of the changed section. This 
                    ' makes the new values available for reading.
                    ConfigurationManager.RefreshSection( _
                        sectionName)
                End If
            Catch e As ConfigurationErrorsException
                Console.WriteLine("[Exception error: {0}]", _
                                  e.ToString())
            End Try

            ' Set console properties using values
            ' stored in the configuration file.
            Console.BackgroundColor = _
                currentSection.ConsoleElement.BackgroundColor
            Console.ForegroundColor = _
                currentSection.ConsoleElement.ForegroundColor
            ' Apply the changes.
            Console.Clear()

            ' Display feedback.
            Console.WriteLine()
            Console.WriteLine( _
                "Using OpenExeConfiguration(userLevel).")
            Console.WriteLine( _
                "Configuration file is: {0}", config.FilePath)
        End Sub

        ' Get the application configuration file.
        ' This function uses the 
        ' OpenExeConfiguration(string)method 
        ' to get the application configuration file. 
        ' It also creates a custom ConsoleSection and 
        ' sets its ConsoleEment BackgroundColor and
        ' ForegroundColor properties to black and white
        ' respectively. Then it uses these properties to
        ' set the console colors.  
        Public Shared Sub GetAppConfiguration()
            ' Get the application path needed to obtain
            ' the application configuration file.
#If DEBUG Then
            Dim applicationName As String = _
                Environment.GetCommandLineArgs()(0)
#Else
            Dim applicationName As String = _
                Environment.GetCommandLineArgs()(0) + ".exe"
#End If

            Dim exePath As String = _
            System.IO.Path.Combine( _
                Environment.CurrentDirectory, applicationName)

            ' Get the configuration file. The file name has
            ' this format appname.exe.config.
            Dim config As System.Configuration.Configuration = _
                ConfigurationManager.OpenExeConfiguration(exePath)

            Try

                ' Create a custom configuration section
                ' having the same name that is used in the 
                ' roaming configuration file.
                ' This is because the configuration section 
                ' can be overridden by lower-level 
                ' configuration files. 
                ' See the GetRoamingConfiguration() function in 
                ' this example.
                Dim sectionName As String = "consoleSection"
                Dim customSection As New ConsoleSection()

                If config.Sections(sectionName) Is Nothing Then
                    ' Create a custom section if it does 
                    ' not exist yet.

                    ' Store console settings.
                    customSection.ConsoleElement. _
                        BackgroundColor = ConsoleColor.Black
                    customSection.ConsoleElement. _
                        ForegroundColor = ConsoleColor.White

                    ' Add configuration information to the
                    ' configuration file.
                    config.Sections.Add(sectionName, _
                                        customSection)
                    config.Save(ConfigurationSaveMode.Modified)
                    ' Force a reload of the changed section.
                    ' This makes the new values available 
                    ' for reading.
                    ConfigurationManager.RefreshSection( _
                        sectionName)
                End If
                ' Set console properties using values
                ' stored in the configuration file.
                customSection = DirectCast( _
                    config.GetSection(sectionName),  _
                        ConsoleSection)
                Console.BackgroundColor = _
                    customSection.ConsoleElement.BackgroundColor
                Console.ForegroundColor = _
                    customSection.ConsoleElement.ForegroundColor
                ' Apply the changes.
                Console.Clear()
            Catch e As ConfigurationErrorsException
                Console.WriteLine("[Error exception: {0}]", _
                                  e.ToString())
            End Try

            ' Display feedback.
            Console.WriteLine()
            Console.WriteLine( _
                "Using OpenExeConfiguration(string).")
            ' Display the current configuration file path.
            Console.WriteLine( _
                "Configuration file is: {0}", config.FilePath)
        End Sub

        ' Get the AppSettings section.        
        ' This function uses the AppSettings property
        ' to read the appSettings configuration 
        ' section.
        Public Shared Sub ReadAppSettings()
            Try
                ' Get the AppSettings section.
                Dim appSettings As NameValueCollection = _
                    ConfigurationManager.AppSettings

                ' Get the AppSettings section elements.
                Console.WriteLine()
                Console.WriteLine("Using AppSettings property.")
                Console.WriteLine("Application settings:")

                If appSettings.Count = 0 Then
                    Console.WriteLine( _
                    "[ReadAppSettings: {0}]", _
                    "AppSettings is empty Use GetSection first.")
                End If
                Dim i As Integer = 0
                While i < appSettings.Count
                    Console.WriteLine( _
                        "#{0} Key: {1} Value: {2}", _
                        i, appSettings.GetKey(i), appSettings(i))
                    System.Math.Max( _
                        System.Threading.Interlocked. _
                        Increment(i), i - 1)
                End While
            Catch e As ConfigurationErrorsException
                Console.WriteLine("[ReadAppSettings: {0}]", _
                                  e.ToString())
            End Try
        End Sub

        ' Get the ConnectionStrings section.        
        ' This function uses the ConnectionStrings 
        ' property to read the connectionStrings
        ' configuration section.
        Public Shared Sub ReadConnectionStrings()

            ' Get the ConnectionStrings collection.
            Dim connections _
                As ConnectionStringSettingsCollection = _
                    ConfigurationManager.ConnectionStrings

            If connections.Count <> 0 Then
                Console.WriteLine()
                Console.WriteLine( _
                    "Using ConnectionStrings property.")
                Console.WriteLine( _
                    "Connection strings:")

                ' Get the collection elements.
                For Each connection _
                    As ConnectionStringSettings In connections
                    Dim name As String = connection.Name
                    Dim provider As String = _
                        connection.ProviderName
                    Dim connectionString As String = _
                        connection.ConnectionString

                    Console.WriteLine( _
                        "Name:               {0}", name)
                    Console.WriteLine( _
                        "Connection string:  {0}", _
                            connectionString)
                    Console.WriteLine( _
                        "Provider:            {0}", provider)
                Next
            Else
                Console.WriteLine()
                Console.WriteLine( _
                    "No connection string is defined.")
                Console.WriteLine()
            End If
        End Sub

        ' Create the AppSettings section.
        ' The function uses the GetSection(string)method 
        ' to access the configuration section. 
        ' It also adds a new element to the section collection.
        Public Shared Sub CreateAppSettings()
            ' Get the application configuration file.
            Dim config As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration( _
                ConfigurationUserLevel.None)

            Dim sectionName As String = "appSettings"

            ' Add an entry to appSettings.
            Dim appStgCnt As Integer = _
                ConfigurationManager.AppSettings.Count
            Dim newKey As String = _
                "NewKey" + appStgCnt.ToString()

            Dim newValue As String = _
                DateTime.Now.ToLongDateString() + " " + _
                DateTime.Now.ToLongTimeString()

            config.AppSettings.Settings.Add(newKey, _
                                            newValue)

            ' Save the configuration file.
            config.Save(ConfigurationSaveMode.Modified)

            ' Force a reload of the changed section. This 
            ' makes the new values available for reading.
            ConfigurationManager.RefreshSection(sectionName)

            ' Get the AppSettings section.
            Dim appSettingSection As AppSettingsSection = _
                DirectCast(config.GetSection(sectionName),  _
                AppSettingsSection)

            ' Display raw xml.
            Console.WriteLine()
            Console.WriteLine( _
                "Using GetSection(string).")
            Console.WriteLine( _
                "AppSettings section XML:")
            Console.WriteLine( _
                appSettingSection.SectionInformation.GetRawXml())
        End Sub

        ' Access the machine configuration file using mapping.
        ' The function uses the OpenMappedMachineConfiguration 
        ' method to access the machine configuration. 
        Public Shared Sub MapMachineConfiguration()
            ' Get the machine.config file.
            Dim machineConfig As Configuration = _
                ConfigurationManager.OpenMachineConfiguration()
            ' Get the machine.config file path.
            Dim configFile _
                As New ConfigurationFileMap( _
                    machineConfig.FilePath)

            ' Map the application configuration file 
            ' to the machine configuration file.
            Dim config As Configuration = _
                ConfigurationManager. _
                OpenMappedMachineConfiguration( _
                    configFile)

            ' Get the AppSettings section.
            Dim appSettingSection As AppSettingsSection = _
                DirectCast(config.GetSection("appSettings"),  _
                    AppSettingsSection)
            appSettingSection.SectionInformation. _
            AllowExeDefinition = _
                ConfigurationAllowExeDefinition. _
                MachineToRoamingUser

            ' Display the configuration file sections.
            Dim sections As  _
                ConfigurationSectionCollection = _
                config.Sections

            Console.WriteLine()
            Console.WriteLine( _
                "Using OpenMappedMachineConfiguration.")
            Console.WriteLine( _
                "Sections in machine.config:")

            ' Get the sections in the machine.config.
            For Each section _
                As ConfigurationSection In sections
                Dim name As String = _
                    section.SectionInformation.Name
                Console.WriteLine("Name: {0}", name)
            Next

        End Sub


        ' Access a configuration file using mapping.
        ' This function uses the OpenMappedExeConfiguration 
        ' method to access a new configuration file.   
        ' It also gets the custom ConsoleSection and 
        ' sets its ConsoleEment BackgroundColor and
        ' ForegroundColor properties to green and red
        ' respectively. Then it uses these properties to
        ' set the console colors.  
        Public Shared Sub MapExeConfiguration()

            ' Get the application configuration file.
            Dim config As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration( _
                ConfigurationUserLevel.None)

            Console.WriteLine(config.FilePath)

            If config Is Nothing Then
                Console.WriteLine( _
                "The configuration file does not exist.")
                Console.WriteLine( _
                "Use OpenExeConfiguration to create file.")
            End If

            ' Create a new configuration file by saving 
            ' the application configuration to a new file.
            Dim appName As String = _
                Environment.GetCommandLineArgs()(0)

            Dim configFile As String = _
                String.Concat(appName, "2.config")
            config.SaveAs(configFile, _
                          ConfigurationSaveMode.Full)

            ' Map the new configuration file.
            Dim configFileMap As New ExeConfigurationFileMap()
            configFileMap.ExeConfigFilename = configFile

            ' Get the mapped configuration file
            config = _
            ConfigurationManager.OpenMappedExeConfiguration( _
                configFileMap, ConfigurationUserLevel.None)

            ' Make changes to the new configuration file. 
            ' This is to show that this file is the 
            ' one that is used.
            Dim sectionName As String = "consoleSection"

            Dim customSection As ConsoleSection = _
                DirectCast(config.GetSection(sectionName),  _
                    ConsoleSection)

            If customSection Is Nothing Then
                customSection = New ConsoleSection()
                config.Sections.Add(sectionName, customSection)
            End If

            ' Change the section configuration values.
            customSection = _
                DirectCast(config.GetSection(sectionName),  _
                    ConsoleSection)
            customSection.ConsoleElement.BackgroundColor = _
                ConsoleColor.Green
            customSection.ConsoleElement.ForegroundColor = _
                ConsoleColor.Red
            ' Save the configuration file.
            config.Save(ConfigurationSaveMode.Modified)

            ' Force a reload of the changed section. This 
            ' makes the new values available for reading.
            ConfigurationManager.RefreshSection(sectionName)

            ' Set console properties using the 
            ' configuration values contained in the 
            ' new configuration file.
            Console.BackgroundColor = _
                customSection.ConsoleElement.BackgroundColor
            Console.ForegroundColor = _
                customSection.ConsoleElement.ForegroundColor
            Console.Clear()

            Console.WriteLine()
            Console.WriteLine( _
                "Using OpenMappedExeConfiguration.")
            Console.WriteLine( _
                "Configuration file is: {0}", config.FilePath)
        End Sub




    End Class
#End Region

#Region "UserInteractionClass"

    '*** User Interaction Class ***//

    ' Obtain user's input and provide feedback.
    ' This class contains the application Main() function.
    ' It calls the ConfigurationManager methods based 
    ' on the user's selection.
    Class ApplicationMain
        ' Display user's menu.
        Public Shared Sub UserMenu()
            Dim applicationName As String = _
                Environment.GetCommandLineArgs()(0) + ".exe"
            Dim buffer As New StringBuilder()

            buffer.AppendLine("Application: " + applicationName)
            buffer.AppendLine("Please, make your selection.")
            buffer.AppendLine("?    -- Display help.")
            buffer.AppendLine("Q,q  -- Exit the application.")
            buffer.Append( _
            "1    -- Use OpenExeConfiguration to get")
            buffer.AppendLine(" the roaming configuration.")
            buffer.Append("        Set console window colors")
            buffer.AppendLine(" to blue and yellow.")
            buffer.Append( _
            "2    -- Use GetSection to read or write")
            buffer.AppendLine(" the specified section.")
            buffer.Append( _
            "3    -- Use ConnectionStrings property")
            buffer.AppendLine(" to read the section.")
            buffer.Append( _
            "4    -- Use OpenExeConfiguration to get")
            buffer.AppendLine(" the application configuration.")
            buffer.Append("        Set console window colors")
            buffer.AppendLine(" to black and white.")
            buffer.Append("5    -- Use AppSettings property")
            buffer.AppendLine(" to read the section.")
            buffer.Append( _
            "6    -- Use OpenMappedExeConfiguration")
            buffer.AppendLine( _
            " to get the specified configuration.")
            buffer.Append("        Set console window colors")
            buffer.AppendLine(" to green and red.")
            buffer.Append( _
            "7    -- Use OpenMappedMachineConfiguration")
            buffer.AppendLine( _
            " to get the machine configuration.")

            Console.Write(buffer.ToString())
        End Sub

        ' Obtain user's input and provide
        ' feedback.
        Shared Sub Main(ByVal args As String())
            ' Define user selection string.
            Dim selection As String = Nothing

            ' Get the name of the application.
            Dim appName As String = _
                Environment.GetCommandLineArgs()(0)


            ' Get user selection.
            While True

                UserMenu()
                Console.Write("> ")
                selection = Console.ReadLine()
                If selection <> String.Empty Then
                    Exit While
                End If
            End While

            While selection.ToLower() <> "q"
                ' Process user's input.
                Select Case selection
                    Case "1"
                        ' Show how to use OpenExeConfiguration
                        ' using the configuration user level.
                        UsingConfigurationManager. _
                            GetRoamingConfiguration()
                        Exit Select
                    Case "2"

                        ' Show how to use GetSection.
                        UsingConfigurationManager. _
                            CreateAppSettings()
                        Exit Select
                    Case "3"

                        ' Show how to use ConnectionStrings.
                        UsingConfigurationManager. _
                            ReadConnectionStrings()
                        Exit Select
                    Case "4"

                        ' Show how to use OpenExeConfiguration
                        ' using the configuration file path.
                        UsingConfigurationManager. _
                            GetAppConfiguration()
                        Exit Select
                    Case "5"

                        ' Show how to use AppSettings.
                        UsingConfigurationManager. _
                            ReadAppSettings()
                        Exit Select
                    Case "6"

                        ' Show how to use 
                        ' OpenMappedExeConfiguration.
                        UsingConfigurationManager. _
                            MapExeConfiguration()
                        Exit Select
                    Case "7"

                        ' Show how to use 
                        ' OpenMappedMachineConfiguration.
                        UsingConfigurationManager. _
                            MapMachineConfiguration()
                        Exit Select
                    Case Else

                        UserMenu()
                        Exit Select
                End Select
                Console.Write("> ")
                selection = Console.ReadLine()
            End While
        End Sub
    End Class
#End Region

End Namespace
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;

// The following example shows how to use the ConfigurationManager 
// class in a console application.
//
// IMPORTANT: To compile this example, you must add to the project 
// a reference to the System.Configuration assembly.
//
namespace Samples.Aspnet
{
  #region
  /*** Auxiliary Classes ***//*/

  // Define a custom configuration element to be 
  // contained by the ConsoleSection. This element 
  // stores background and foreground colors that
  // the application applies to the console window.
  public class ConsoleConfigElement : ConfigurationElement
  {
    // Create the element.
    public ConsoleConfigElement()
    { }

    // Create the element.
    public ConsoleConfigElement(ConsoleColor fColor, 
        ConsoleColor bColor)
    {
      ForegroundColor = fColor;
      BackgroundColor = bColor;
    }

    // Get or set the console background color.
    [ConfigurationProperty("background",
      DefaultValue = ConsoleColor.Black,
      IsRequired = false)]
    public ConsoleColor BackgroundColor
    {
      get
      {
        return (ConsoleColor)this["background"];
      }
      set
      {
        this["background"] = value;
      }
    }

    // Get or set the console foreground color.
    [ConfigurationProperty("foreground",
       DefaultValue = ConsoleColor.White,
       IsRequired = false)]
    public ConsoleColor ForegroundColor
    {
      get
      {
        return (ConsoleColor)this["foreground"];
      }
      set
      {
        this["foreground"] = value;
      }
    }
  }

  // Define a custom section that is used by the application
  // to create custom configuration sections at the specified 
  // level in the configuration hierarchy that is in the 
  // proper configuration file.
  // This enables the user that has the proper access 
  // rights, to make changes to the configuration files.
  public class ConsoleSection : ConfigurationSection
  {
    // Create a configuration section.
    public ConsoleSection()
    { }

    // Set or get the ConsoleElement. 
    [ConfigurationProperty("consoleElement")]
    public ConsoleConfigElement ConsoleElement
    {
      get
      {
        return (
          (ConsoleConfigElement) this["consoleElement"]);
      }
      set
      {
        this["consoleElement"] = value;
      }
    }
  }
  #endregion

  #region
  /*** ConfigurationManager Interaction Class ***//*/

  // The following code uses the ConfigurationManager class to 
  // perform the following tasks:
  // 1) Get the application roaming configuration file.
  // 2) Get the application configuration file.
  // 3) Access a specified configuration file through mapping.
  // 4) Access the machine configuration file through mapping. 
  // 5) Read a specified configuration section.
  // 6) Read the connectionStrings section.
  // 7) Read or write the appSettings section.
  public static class UsingConfigurationManager
  {

    // Get the roaming configuration file associated 
    // with the application.
    // This function uses the OpenExeConfiguration(
    // ConfigurationUserLevel userLevel) method to 
    // get the configuration file.
    // It also creates a custom ConsoleSection and 
    // sets its ConsoleEment BackgroundColor and
    // ForegroundColor properties to blue and yellow
    // respectively. Then it uses these properties to
    // set the console colors.  
    public static void GetRoamingConfiguration()
    {
      // Define the custom section to add to the
      // configuration file.
      string sectionName = "consoleSection";
      ConsoleSection currentSection = null;

      // Get the roaming configuration 
      // that applies to the current user.
      Configuration roamingConfig =
        ConfigurationManager.OpenExeConfiguration(
         ConfigurationUserLevel.PerUserRoaming);

      // Map the roaming configuration file. This
      // enables the application to access 
      // the configuration file using the
      // System.Configuration.Configuration class
      ExeConfigurationFileMap configFileMap =
        new ExeConfigurationFileMap();
      configFileMap.ExeConfigFilename = 
        roamingConfig.FilePath;

      // Get the mapped configuration file.
      Configuration config =
        ConfigurationManager.OpenMappedExeConfiguration(
          configFileMap, ConfigurationUserLevel.None);

      try
        {
          currentSection =
               (ConsoleSection)config.GetSection(
                 sectionName);

          // Synchronize the application configuration
          // if needed. The following two steps seem
          // to solve some out of synch issues 
          // between roaming and default
          // configuration.
          config.Save(ConfigurationSaveMode.Modified);

          // Force a reload of the changed section, 
          // if needed. This makes the new values available 
          // for reading.
          ConfigurationManager.RefreshSection(sectionName);

          if (currentSection == null)
          {
            // Create a custom configuration section.
            currentSection = new ConsoleSection();

            // Define where in the configuration file 
            // hierarchy the associated 
            // configuration section can be declared.
            // The following assignment assures that 
            // the configuration information can be 
            // defined in the user.config file in the 
            // roaming user directory. 
            currentSection.SectionInformation.AllowExeDefinition =
              ConfigurationAllowExeDefinition.MachineToLocalUser;

            // Allow the configuration section to be 
            // overridden by lower-level configuration files.
            // This means that lower-level files can contain
            // the section (use the same name) and assign 
            // different values to it as done by the
            // function GetApplicationConfiguration() in this
            // example.
            currentSection.SectionInformation.AllowOverride =
              true;

            // Store console settings for roaming users.
            currentSection.ConsoleElement.BackgroundColor =
                ConsoleColor.Blue;
            currentSection.ConsoleElement.ForegroundColor =
                ConsoleColor.Yellow;

            // Add configuration information to 
            // the configuration file.
            config.Sections.Add(sectionName, currentSection);
            config.Save(ConfigurationSaveMode.Modified);
            // Force a reload of the changed section. This 
            // makes the new values available for reading.
            ConfigurationManager.RefreshSection(
              sectionName);
          }
      }
      catch (ConfigurationErrorsException e)
      {
          Console.WriteLine("[Exception error: {0}]",
              e.ToString());
      }

      // Set console properties using values
      // stored in the configuration file.
      Console.BackgroundColor =
        currentSection.ConsoleElement.BackgroundColor;
      Console.ForegroundColor =
        currentSection.ConsoleElement.ForegroundColor;
      // Apply the changes.
      Console.Clear();

      // Display feedback.
      Console.WriteLine();
      Console.WriteLine(
        "Using OpenExeConfiguration(ConfigurationUserLevel).");
      Console.WriteLine(
          "Configuration file is: {0}", config.FilePath);
    }

    // Get the application configuration file.
    // This function uses the 
    // OpenExeConfiguration(string)method 
    // to get the application configuration file. 
    // It also creates a custom ConsoleSection and 
    // sets its ConsoleEment BackgroundColor and
    // ForegroundColor properties to black and white
    // respectively. Then it uses these properties to
    // set the console colors.  
    public static void GetAppConfiguration()
    {

      // Get the application path needed to obtain
      // the application configuration file.
#if DEBUG
      string applicationName =
          Environment.GetCommandLineArgs()[0];
#else
           string applicationName =
          Environment.GetCommandLineArgs()[0]+ ".exe";
#endif

      string exePath = System.IO.Path.Combine(
          Environment.CurrentDirectory, applicationName);

      // Get the configuration file. The file name has
      // this format appname.exe.config.
      System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(exePath);

      try
      {

        // Create a custom configuration section
        // having the same name that is used in the 
        // roaming configuration file.
        // This is because the configuration section 
        // can be overridden by lower-level 
        // configuration files. 
        // See the GetRoamingConfiguration() function in 
        // this example.
        string sectionName = "consoleSection";
        ConsoleSection customSection = new ConsoleSection();

        if (config.Sections[sectionName] == null)
        {
          // Create a custom section if it does 
          // not exist yet.

          // Store console settings.
          customSection.ConsoleElement.BackgroundColor =
              ConsoleColor.Black;
          customSection.ConsoleElement.ForegroundColor =
              ConsoleColor.White;

          // Add configuration information to the
          // configuration file.
          config.Sections.Add(sectionName, customSection);
          config.Save(ConfigurationSaveMode.Modified);
          // Force a reload of the changed section.
          // This makes the new values available for reading.
          ConfigurationManager.RefreshSection(sectionName);
        }
        // Set console properties using values
        // stored in the configuration file.
        customSection =
            (ConsoleSection)config.GetSection(sectionName);
        Console.BackgroundColor =
            customSection.ConsoleElement.BackgroundColor;
        Console.ForegroundColor =
            customSection.ConsoleElement.ForegroundColor;
        // Apply the changes.
        Console.Clear();
      }
      catch (ConfigurationErrorsException e)
      {
        Console.WriteLine("[Error exception: {0}]",
            e.ToString());
      }

      // Display feedback.
      Console.WriteLine();
      Console.WriteLine("Using OpenExeConfiguration(string).");
      // Display the current configuration file path.
      Console.WriteLine("Configuration file is: {0}", 
        config.FilePath);
    }

    // Get the AppSettings section.        
    // This function uses the AppSettings property
    // to read the appSettings configuration 
    // section.
    public static void ReadAppSettings()
    {
      try
      {
        // Get the AppSettings section.
        NameValueCollection appSettings =
           ConfigurationManager.AppSettings;

        // Get the AppSettings section elements.
        Console.WriteLine();
        Console.WriteLine("Using AppSettings property.");
        Console.WriteLine("Application settings:");

        if (appSettings.Count == 0)
        {
          Console.WriteLine("[ReadAppSettings: {0}]",
          "AppSettings is empty Use GetSection command first.");
        }
        for (int i = 0; i < appSettings.Count; i++)
        {
          Console.WriteLine("#{0} Key: {1} Value: {2}",
            i, appSettings.GetKey(i), appSettings[i]);
        }
      }
      catch (ConfigurationErrorsException e)
      {
        Console.WriteLine("[ReadAppSettings: {0}]",
            e.ToString());
      }
    }

    // Get the ConnectionStrings section.        
    // This function uses the ConnectionStrings 
    // property to read the connectionStrings
    // configuration section.
    public static void ReadConnectionStrings()
    {

      // Get the ConnectionStrings collection.
      ConnectionStringSettingsCollection connections =
          ConfigurationManager.ConnectionStrings;

      if (connections.Count != 0)
      {
        Console.WriteLine();
        Console.WriteLine("Using ConnectionStrings property.");
        Console.WriteLine("Connection strings:");

        // Get the collection elements.
        foreach (ConnectionStringSettings connection in 
          connections)
        {
          string name = connection.Name;
          string provider = connection.ProviderName;
          string connectionString = connection.ConnectionString;

          Console.WriteLine("Name:               {0}", 
            name);
          Console.WriteLine("Connection string:  {0}", 
            connectionString);
         Console.WriteLine("Provider:            {0}", 
            provider);
        }
      }
      else
      {
        Console.WriteLine();
        Console.WriteLine("No connection string is defined.");
        Console.WriteLine();
      }
    }

    // Create the AppSettings section.
    // The function uses the GetSection(string)method 
    // to access the configuration section. 
    // It also adds a new element to the section collection.
    public static void CreateAppSettings()
    {
      // Get the application configuration file.
      System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(
              ConfigurationUserLevel.None);

      string sectionName = "appSettings";

      // Add an entry to appSettings.
      int appStgCnt =
          ConfigurationManager.AppSettings.Count;
      string newKey = "NewKey" + appStgCnt.ToString();

      string newValue = DateTime.Now.ToLongDateString() + 
        " " + DateTime.Now.ToLongTimeString();

      config.AppSettings.Settings.Add(newKey, newValue);

      // Save the configuration file.
      config.Save(ConfigurationSaveMode.Modified);

      // Force a reload of the changed section. This 
      // makes the new values available for reading.
      ConfigurationManager.RefreshSection(sectionName);

      // Get the AppSettings section.
      AppSettingsSection appSettingSection =
        (AppSettingsSection)config.GetSection(sectionName);

      // Display raw xml.
      Console.WriteLine();
      Console.WriteLine("Using GetSection(string).");
      Console.WriteLine("AppSettings section XML:");
      Console.WriteLine(
        appSettingSection.SectionInformation.GetRawXml());
    }

    // Access the machine configuration file using mapping.
    // The function uses the OpenMappedMachineConfiguration 
    // method to access the machine configuration. 
    public static void MapMachineConfiguration()
    {
      // Get the machine.config file.
      Configuration machineConfig =
        ConfigurationManager.OpenMachineConfiguration();
      // Get the machine.config file path.
      ConfigurationFileMap configFile =
        new ConfigurationFileMap(machineConfig.FilePath);

      // Map the application configuration file to the machine 
      // configuration file.
      Configuration config =
        ConfigurationManager.OpenMappedMachineConfiguration(
          configFile);

      // Get the AppSettings section.
      AppSettingsSection appSettingSection =
        (AppSettingsSection)config.GetSection("appSettings");
      appSettingSection.SectionInformation.AllowExeDefinition =
          ConfigurationAllowExeDefinition.MachineToRoamingUser;

      // Display the configuration file sections.
      ConfigurationSectionCollection sections = 
        config.Sections;

      Console.WriteLine();
      Console.WriteLine("Using OpenMappedMachineConfiguration.");
      Console.WriteLine("Sections in machine.config:");

      // Get the sections in the machine.config.
      foreach (ConfigurationSection section in sections)
      {
          string name = section.SectionInformation.Name;
          Console.WriteLine("Name: {0}", name);
      }

    }



    // Access a configuration file using mapping.
    // This function uses the OpenMappedExeConfiguration 
    // method to access a new configuration file.   
    // It also gets the custom ConsoleSection and 
    // sets its ConsoleEment BackgroundColor and
    // ForegroundColor properties to green and red
    // respectively. Then it uses these properties to
    // set the console colors.  
    public static void MapExeConfiguration()
    {

      // Get the application configuration file.
      System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(
              ConfigurationUserLevel.None);

      Console.WriteLine(config.FilePath);

      if (config == null)
      {
        Console.WriteLine(
          "The configuration file does not exist.");
        Console.WriteLine(
         "Use OpenExeConfiguration to create the file.");
      }

      // Create a new configuration file by saving 
      // the application configuration to a new file.
      string appName = 
        Environment.GetCommandLineArgs()[0];

      string configFile =  string.Concat(appName, 
        ".2.config");
      config.SaveAs(configFile, ConfigurationSaveMode.Full);

      // Map the new configuration file.
      ExeConfigurationFileMap configFileMap = 
          new ExeConfigurationFileMap();
      configFileMap.ExeConfigFilename = configFile;

      // Get the mapped configuration file
     config = 
        ConfigurationManager.OpenMappedExeConfiguration(
          configFileMap, ConfigurationUserLevel.None);

      // Make changes to the new configuration file. 
      // This is to show that this file is the 
      // one that is used.
      string sectionName = "consoleSection";

      ConsoleSection customSection =
        (ConsoleSection)config.GetSection(sectionName);

      if (customSection == null)
      {
          customSection = new ConsoleSection();
          config.Sections.Add(sectionName, customSection);
      }
      else
          // Change the section configuration values.
          customSection =
              (ConsoleSection)config.GetSection(sectionName);

      customSection.ConsoleElement.BackgroundColor =
          ConsoleColor.Green;
      customSection.ConsoleElement.ForegroundColor =
          ConsoleColor.Red;

      // Save the configuration file.
      config.Save(ConfigurationSaveMode.Modified);

      // Force a reload of the changed section. This 
      // makes the new values available for reading.
      ConfigurationManager.RefreshSection(sectionName);

      // Set console properties using the 
      // configuration values contained in the 
      // new configuration file.
      Console.BackgroundColor =
        customSection.ConsoleElement.BackgroundColor;
      Console.ForegroundColor =
        customSection.ConsoleElement.ForegroundColor;
      Console.Clear();

      Console.WriteLine();
      Console.WriteLine("Using OpenMappedExeConfiguration.");
      Console.WriteLine("Configuration file is: {0}", 
        config.FilePath);
    }


  }
  #endregion

  #region
  /*** User Interaction Class ***//*/

  // Obtain user's input and provide feedback.
  // This class contains the application Main() function.
  // It calls the ConfigurationManager methods based 
  // on the user's selection.
  class ApplicationMain
  {
    // Display user's menu.
    public static void UserMenu()
    {
      string applicationName =
         Environment.GetCommandLineArgs()[0] + ".exe";
      StringBuilder buffer = new StringBuilder();

      buffer.AppendLine("Application: " + applicationName);
      buffer.AppendLine("Please, make your selection.");
      buffer.AppendLine("?    -- Display help.");
      buffer.AppendLine("Q,q  -- Exit the application.");
      buffer.Append("1    -- Use OpenExeConfiguration to get");
      buffer.AppendLine(" the roaming configuration.");
      buffer.Append("        Set console window colors");
      buffer.AppendLine(" to blue and yellow.");
      buffer.Append("2    -- Use GetSection to read or write");
      buffer.AppendLine(" the specified section.");
      buffer.Append("3    -- Use ConnectionStrings property");
      buffer.AppendLine(" to read the section.");
      buffer.Append("4    -- Use OpenExeConfiguration to get");
      buffer.AppendLine(" the application configuration.");
      buffer.Append("        Set console window colors");
      buffer.AppendLine(" to black and white.");
      buffer.Append("5    -- Use AppSettings property");
      buffer.AppendLine(" to read the section.");
      buffer.Append("6    -- Use OpenMappedExeConfiguration");
      buffer.AppendLine(" to get the specified configuration.");
      buffer.Append("        Set console window colors");
      buffer.AppendLine(" to green and red.");
      buffer.Append("7    -- Use OpenMappedMachineConfiguration");
      buffer.AppendLine(" to get the machine configuration.");

      Console.Write(buffer.ToString());
    }

    // Obtain user's input and provide
    // feedback.
    static void Main(string[] args)
    {
      // Define user selection string.
      string selection;

      // Get the name of the application.
      string appName = 
        Environment.GetCommandLineArgs()[0];


      // Get user selection.
      while (true)
      {

        UserMenu();
        Console.Write("> ");
        selection = Console.ReadLine();
        if (selection != string.Empty)
          break;
      }

      while (selection.ToLower() != "q")
      { 
        // Process user's input.
        switch (selection)
        {
          case "1":
            // Show how to use OpenExeConfiguration
            // using the configuration user level.
            UsingConfigurationManager.GetRoamingConfiguration();
            break;

          case "2":
            // Show how to use GetSection.
            UsingConfigurationManager.CreateAppSettings();
            break;

          case "3":
            // Show how to use ConnectionStrings.
            UsingConfigurationManager.ReadConnectionStrings();
            break;

          case "4":
            // Show how to use OpenExeConfiguration
            // using the configuration file path.
            UsingConfigurationManager.GetAppConfiguration();
            break;

          case "5":
            // Show how to use AppSettings.
            UsingConfigurationManager.ReadAppSettings();
            break;

          case "6":
            // Show how to use OpenMappedExeConfiguration.
            UsingConfigurationManager.MapExeConfiguration();
            break;

          case "7":
            // Show how to use OpenMappedMachineConfiguration.
            UsingConfigurationManager.MapMachineConfiguration();
            break;

          default:
            UserMenu();
            break;
        }
          Console.Write("> ");
          selection = Console.ReadLine();
      } 
    }
  }
  #endregion
}

The example works with elements that are similar to the ones illustrated in the following configuration file. These elements are generated the first time that you run the example.

None
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="consoleSection" type="Samples.Aspnet.ConsoleSection, 
             ConfigurationManager_CS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </configSections>
  <appSettings>
        <add key="NewKey0" value="Monday, March 30, 
             2009 1:36:33 PM" />
        <add key="NewKey1" value="Monday, March 30, 
             2009 1:36:40 PM" />
    </appSettings>
  <consoleSection>
        <consoleElement background="Black" foreground="White" />
    </consoleSection>
</configuration>

System..::.Object
  System.Configuration..::.ConfigurationManager
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
To Compile the Example      jleather ... michaelonmsdn   |   Edit   |   Show History

IMPORTANT: To compile the example, you must add to the project
a reference to the System.Configuration assembly.

Tags What's this?: Add a tag
Flag as ContentBug
C# code      TOANDO ... michaelonmsdn   |   Edit   |   Show History

Please, see the updated code example.

Tags What's this?: Add a tag
Flag as ContentBug
Using the ConfigurationManager Example      michaelonmsdn ... Tom Dykstra - MSFT   |   Edit   |   Show History
When you have a chance, please look at the post at this location:
http://blogs.msdn.com/aspnetue/archive/2008/10/02/configuration-api-using-system-configuration-configurationmanager.aspx.
It shows a console application that uses the ConfigurationManager class.
The code example extends what is already in the current documentation to demonstrate the use of this class.
We look forward to your comments and feedback.
Thank you.
Microsoft.WindowsMobile.Configuration      Dave H [MSFT]   |   Edit   |   Show History
At least for .NET CF 3.5, it seems you need to instead use Microsoft.WindowsMobile.Configuration, rather than System.Configuration
Tags What's this?: Add a tag
Flag as ContentBug
Puzzling result      Gies   |   Edit   |   Show History

Hi, I want to read configurationfiles from other applications, so I tried this example out. And the result puzzles me.

I've changed the filename 'ConfigurationManager_CS.config' into 'Interface.dll.config'.

This is my configuration file 'Interface.dll.config' (one connectionstring and one parameter) :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SomeInterface.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="SomeInterface.Properties.Settings.MyDBConnectionString"
connectionString="Data Source=localhost;Initial Catalog=B_TEST;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<applicationSettings>
<SomeInterface.Properties.Settings>
<setting name="SetDownloadFlag" serializeAs="Bool">
<value>True</value>
</setting>
</SomeInterface.Properties.Settings>
</applicationSettings>
</configuration>

This is the output from the sample :


Using OpenExeConfiguration(ConfigurationUserLevel).
Show appSettings section elements:
#0 Key: NewKey0 Value: zondag 30 november 2008 23:00:33

Using AppSettings property.
Show appSettings section elements:
#0 Key: NewKey0 Value: zondag 30 november 2008 23:00:33

Using OpenExeConfiguration(string).
Show sections in the configuration file:
Name: system.data
Name: windows
Name: system.webServer
Name: mscorlib
Name: system.data.oledb
Name: system.data.oracleclient
Name: system.data.sqlclient
Name: configProtectedData
Name: satelliteassemblies
Name: system.data.dataset
Name: startup
Name: system.data.odbc
Name: system.diagnostics
Name: runtime
Name: system.codedom
Name: system.runtime.remoting
Name: connectionStrings
Name: assemblyBinding
Name: appSettings
Name: system.windows.forms

Using ConnectionStrings property.
Connection strings:
Name: LocalSqlServer
Connection string: data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFi
lename=|DataDirectory|aspnetdb.mdf;User Instance=true
Provider: System.Data.SqlClient

Using GetSection(string).
AppSettings section XML:
<appSettings>
<add key="NewKey0" value="zondag 30 november 2008 23:00:33" />
</appSettings>

Using OpenMappedMachineConfiguration.
Sections in machine.config:
Name: system.data
Name: windows
Name: system.webServer
Name: mscorlib
Name: system.data.oledb
Name: system.data.oracleclient
Name: system.data.sqlclient
Name: configProtectedData
Name: satelliteassemblies
Name: system.data.dataset
Name: startup
Name: system.data.odbc
Name: system.diagnostics
Name: runtime
Name: system.codedom
Name: system.runtime.remoting
Name: connectionStrings
Name: assemblyBinding
Name: appSettings
Name: system.windows.forms

Using OpenMappedExeConfiguration.
AppSettings section XML:


Using OpenMachineConfiguration.
Connection strings in machine.config:
Name: LocalSqlServer
Connection string: data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFi
lename=|DataDirectory|aspnetdb.mdf;User Instance=true
Provider: System.Data.SqlClient

This is not what I expected, I expected that the connectionstring and the parameter would be also outputted. Can anyone explain to me why this doesn't happen in this sample, and how this should be done?

Thanks, Gijs

Useful Example?      tinmanPA   |   Edit   |   Show History
I don't know how many times I would need to loop and print out my config settings. How about a useful example of how to read a specific key's value from the config file?
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker