Name

<httpHandlers>

Synopsis

<httpHandlers>
   <add verb=httpVerbs 
      path=pathInfo 
      type=typeInfo 
      validate=boolean />
   <remove verb=httpVerbs 
      path=pathInfo />
   <clear />
</httpHandlers>

Adds or removes HttpHandlers, which are used to provide request processing for a specified HTTP verb and/or file type or path. ASP.NET itself is set up as an HttpHandler for .aspx and .asmx files, and HttpHandlers are used to prevent downloading of source code for other ASP.NET file types, such as global.asax.

Scope

Any

Attributes

None

Child Elements

<add>

Adds an HttpHandler. The HTTP verbs (GET, POST, etc.) handled by the HttpHandler are specified by the verb attribute; the asterisk (*) wildcard is used to specify all verbs. The path or file extension to be handled by the HttpHandler is specified by the path attribute. The class used to process the request is specified by the type attribute. This class must implement the IHttpHandler interface. Finally, the validate attribute tells ASP.NET whether or not to attempt to load the class specified by the type attribute before a matching request comes in.

<remove>

Removes a previously configured HttpHandler, based on the specified verb and path attributes. The attributes must match a previously configured <add> element.

<clear>

Clears all previously configured HttpHandlers.

Example

The example configures a custom HttpHandler for the file extension .aspnetian:

<configuration> <system.web> <httpHandlers> <add verb="*" path="*.aspnetian" type="aspnetian.aspnetianHandler" ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.