Export (0) Print
Expand All

ConfigurationManager.RefreshSection Method

Refreshes the named section so the next time that it is retrieved it will be re-read from disk.

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

public static void RefreshSection (
	string sectionName
public static void RefreshSection (
	String sectionName
public static function RefreshSection (
	sectionName : String
Not applicable.



The configuration section name or the configuration path and section name of the section to refresh.

This method invalidates the cache for the specified configuration section without affecting other sections.

The following code example shows how to use the RefreshSection method to refresh the application settings configuration section.

// Show how to use OpenExeConfiguration(ConfigurationUserLevel) 
// and RefreshSection.
static void UpdateAppSettings()
    // Get the configuration file.
    System.Configuration.Configuration config =

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

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

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

    // Save the configuration file.

    // Force a reload of the changed section.


Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2014 Microsoft