Export (0) Print
Expand All

SectionInformation::ConfigSource Property

Gets or sets the name of the include file in which the associated configuration section is defined, if such a file exists.

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

public:
property String^ ConfigSource {
	String^ get ();
	void set (String^ value);
}

Property Value

Type: System::String
The name of the include file in which the associated ConfigurationSection is defined, if such a file exists; otherwise, an empty string ("").

The ConfigSource property represents the value of the configSource attribute that is specified for a ConfigurationSection object that is associated with the SectionInformation object.

A ConfigurationSection implementation can optionally specify a separate file in which the configuration settings for that section are defined. This can be useful in multiple ways:

  • Using include files can result in a more logical and modular structure for configuration files.

  • File-access security and permissions can be used to restrict access to sections of configuration settings.

  • Settings in an include file that are not used during application initialization can be modified and reloaded without requiring an application restart.

The following example shows how this attribute is used in a configuration file to specify that the pages section is defined in an external include file:

<pages configSource="pages.config"/>

If any of the settings in a configuration include file require the application to restart when they are modified, set the RestartOnExternalChanges property to true.

In ASP.NET applications, at run time you can assign to the ConfigSource property the name of an alternative configuration file. In that case, the contents of the file are overwritten by the default connection string information that is contained in the Web.config file. This occurs also when the alternative file does not exist and it is created at run time. If the Web.config file does not contain any connection string information, an empty connectionStrings section is added to the alternative file.

.NET Framework

Supported in: 4.5.3, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft