WebControlsSection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
配置 webControls
节。 此类不能被继承。
public ref class WebControlsSection sealed : System::Configuration::ConfigurationSection
public sealed class WebControlsSection : System.Configuration.ConfigurationSection
type WebControlsSection = class
inherit ConfigurationSection
Public NotInheritable Class WebControlsSection
Inherits ConfigurationSection
- 继承
示例
下面的代码示例演示如何从与现有 Web 应用程序关联的配置文件中获取 WebControlsSection 对象。
// Get the Web application configuration.
System.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 System.Configuration.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)
注解
WebControlsSection 类提供一种以编程方式访问和修改配置文件的 webControls
节的方法。
注意
ASP.NET 为客户端脚本文件提供共享位置,可以从多个页面和跨应用程序访问这些文件。 WebControlsSection可以根据值为 Everywhere的 section 属性AllowDefinition,从 配置文件的相关节读取和写入信息。
构造函数
WebControlsSection() |
创建 WebControlsSection 的新实例。 |