HttpHandlersSection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
為網頁應用程式配置 HTTP 處理器。 此類別無法獲得繼承。
public ref class HttpHandlersSection sealed : System::Configuration::ConfigurationSection
public sealed class HttpHandlersSection : System.Configuration.ConfigurationSection
type HttpHandlersSection = class
inherit ConfigurationSection
Public NotInheritable Class HttpHandlersSection
Inherits ConfigurationSection
- 繼承
範例
以下程式碼範例說明如何利用該 HttpHandlersSection 類別存取現有網頁應用程式的該 httpHandlers 區段。
// Get the Web application configuration.
System.Configuration.Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the section.
System.Web.Configuration.HttpHandlersSection httpHandlersSection = (System.Web.Configuration.HttpHandlersSection) configuration.GetSection("system.web/httphandlers");
' Get the Web application configuration.
Dim configuration As System.Configuration.Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest")
' Get the section.
Dim httpHandlersSection As System.Web.Configuration.HttpHandlersSection = CType(configuration.GetSection("system.web/httphandlers"), System.Web.Configuration.HttpHandlersSection)
以下配置摘錄展示了如何以宣告式 httpHandlers 方式指定該區段的值。
<httpHandlers>
<add path="Calculator.custom"
type="Samples.Aspnet.SystemWebConfiguration.Calculator, CalculatorHandler"
verb="GET" validate="false" />
</httpHandlers>
備註
這個 HttpHandlersSection 類別提供一種程式化的方式,可以存取並修改設定檔的該 httpHandlers 區段。 此類型屬於包含 和 HttpHandlerActionHttpHandlerActionCollection 的群組。
Note
可以HttpHandlersSection根據該區段屬性(值為 AllowDefinition)從設定檔Everywhere的相關區段讀寫資訊。
建構函式
| 名稱 | Description |
|---|---|
| HttpHandlersSection() |
初始化 HttpHandlersSection 類別的新執行個體。 |