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 類別 (Class) 提供以程式的方法,存取和修改組態檔的 webControls 區段。
注意
ASP.NET 提供用戶端文本檔案的共用位置,您可以在其中從多個頁面和跨應用程式存取它們。 WebControlsSection可以根據值為 Everywhere的 section 屬性AllowDefinition,從 組態檔的相關區段讀取和寫入資訊。
建構函式
| WebControlsSection() |
建立 WebControlsSection 的新執行個體。 |