HttpHandlersSection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 Web 应用程序配置 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
现有 Web 应用程序的 部分。
// 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
节的方法。 此类型是包含 HttpHandlerAction 和 类型的组的 HttpHandlerActionCollection 一部分。
注意
HttpHandlersSection可以根据值为 Everywhere的 section 属性,从 配置文件的相关节AllowDefinition读取和写入信息。
构造函数
HttpHandlersSection() |
初始化 HttpHandlersSection 类的新实例。 |