<httpHandlers> Element
Maps incoming requests to the appropriate IHttpHandler or IHttpHandlerFactory class, according to the URL and the HTTP verb specified in the request.
<configuration>
<system.web>
<httpHandlers>
<httpHandlers>
<add verb="verb list"
path="path/wildcard"
type="type,assemblyname"
validate="true|false"/>
<remove verb="verb list"
path="path/wildcard"/>
<clear/>
</httpHandlers>
Subtags
Subtag | Description |
---|---|
<add> | Specifies verb/path mapping to an IHttpHandler or IHttpHandlerFactory class. |
<remove> | Removes a verb/path mapping to an IHttpHandler class. The <remove> directive must exactly match the verb/path combination of a previous <add> directive. Wildcard characters are not supported. |
<clear> | Removes all IHttpHandler mappings currently configured or inherited by the specified Web.config file. |
Remarks
The <httpHandlers> settings are inherited by subdirectories.
The <add> directives are processed in top-down sequential order. If two or more <add> subelements specify the same verb/path combination, the final <add> overrides all others.
Please note that Microsoft Internet Information Services (IIS) has its own concept of mapping extensions to ISAPIs. For the settings for a given extension in this section to take effect, the extension must be mapped in IIS to ASP.NET ISAPI. For nonstandard extensions (something other than .aspx, .asmx, .asax, and so on), the user must configure IIS.
Example
The following example maps all HTTP requests for files with file name extension .New
to the class MyHandler.New
and for HTTP GET and HTTP HEAD requests for files with file name extension .MyNewFileExtension
to the class MyHandler.MNFEHandler.
Both classes are in the assembly MyHandler
that is in the file MyHandler.dll
.
<configuration>
<system.web>
<httpHandlers>
<add verb="*"
path="*.New"
type="MyHandler.New,MyHandler"/>
<add verb="GET,HEAD"
path="*.MyNewFileExtension"
type="MyHandler.MNFEHandler,MyHandler.dll"/>
</httpHandlers>
<system.web>
</configuration>
Requirements
Contained Within: <system.web>
Web Platform: IIS 5.0, IIS 5.1, IIS 6.0
Configuration File: Machine.config, Web.config
Configuration Section Handler: System.Web.Configuration.HttpHandlersConfigHandler