ASP.NET Syntax ASP.NET Configuration Sections
Maps incoming requests to the appropriate IHttpHandler or IHttpHandlerFactory class, according to the URL and HTTP verb specified in the request.
<httpHandlers>
<add verb = "verb list"
path = "path/wildcard"
type = "type,assemblyname" />
<remove verb = "verb list"
path = "path/wildcard" />
<clear />
</httpHandlers>
The <httpHandlers
> tag supports three subtags.
Subtag |
Description |
<add > |
Specifies verb/path mapping to an IHttpHandler or IHttpHandlerFactory class. |
The <add
> tag supports three attributes.
Attribute |
Description |
verb |
The verb list can be either a comma-separated list of HTTP verbs ( for example: "GET, PUT, POST" ) or a start-script mapping ( for example, the wildcard character * [ an asterisk ] ). |
path |
The path attribute can contain either a single URL path or a simple wildcard string ( for example, *.aspx ). |
type |
Specifies a comma-separated class/assembly combination. ASP.NET searches for the assembly DLL first in the application’s private "bin" directory and then in the system assembly cache. |
Subtag |
Description |
<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. Wildcards are not supported. |
The <remove
> tag supports two attributes.
Attribute |
Description |
verb |
The verb list that matches the verb list of the handler to be removed. |
path |
The path that matches the path of the handler to be removed. |
Subtag |
Description |
<clear > |
Removes all IHttpHandler mappings currently configured or inherited by the specified Web.config file. |
The <httpHandlers
> settings are inherited by subdirectories.
The <add
> directives are processed in a top-down sequential order. If two or more <add
> subelements specify the same verb/path combination, the final <add
> overrides all others.
The following example maps all HTTP requests to the classes MyHandler.New and MyHandler.Fin, in the assembly MyHandler that is in the file Myhandler.dll.
<configuration>
<system.web>
<httpHandlers>
<add verb = "*" path = " MyHandler.New"
type = "MyHandler.New, MyHandler.dll" />
<add verb = "*" path = " MyHandler.Fin"
type = " MyHandler.Fin, MyHandler.dll" />
</httpHandlers>
<system.web>
</configuration>
ASP.NET Configuration HttpHandlersSection Class