System.Web.Configuration Namespace
.NET Framework version 2.0
Provides programmatic access to the webControls configuration file section. This class cannot be inherited.
The WebControlsSection class provides a way to programmatically access and modify the webControls section of a configuration file.
NOTE: ASP.NET provides a shared location for the client script files, where they can be accessed from multiple pages and across applications. The WebControlsSection can read and write information from and to the related section of the configuration file according to the section property AllowDefinition whose value is Everywhere.
The following code example shows how to obtain the WebControlsSection object from the configuration file associated with an existing Web application.
// Get the Web application configuration.
Configuration configuration = WebConfigurationManager.OpenWebConfiguration ( "/aspnetTest" );
// Get the <webControls> section.
WebControlsSection webControlsSection = ( WebControlsSection ) configuration.GetSection
( "system.web/webControls" );
// Read the client script location.
string clientScriptLocation = webControlsSection.ClientScriptsLocation;
string msg = String.Format ( "Client script location: {0}\n", clientScriptLocation );
Console.Write ( msg );
' Get the Web application configuration.
Dim configuration As Configuration = WebConfigurationManager.OpenWebConfiguration ( "/aspnetTest" )
' Get the <webControls> section.
Dim webControlsSection As WebControlsSection = CType ( configuration.GetSection
( "system.web/webControls" ), WebControlsSection )
' Read the client script location.
Dim clientScriptLocation As String = webControlsSection.ClientScriptsLocation
Dim msg As String = String.Format ( "Client script location: {0}" + ControlChars.Lf, clientScriptLocation )
Console.Write ( msg ) |
|
C# |
VB |
ASP.NET Configuration <webControls> Section