HTTP handlers are the .NET components that implement the System.Web.IHttpHandler interface. A class which is implementing IHttpHandler interface can act as a target for the incoming HTTP requests. Handlers are very similar to Internet Server Application Programming Interface (ISAPI) extensions. The IHttpHandler interface has one method and one property with the following parameters:
void ProcessRequest(HttpContext);
bool IsReusable {get;}
Different Functions in Http Handler
The following are the 2 functions in Http Handlers.
| Method Name |
Description? |
| ProcessRequest |
This function is used to call Http Requests. |
| IsReusable |
This function is used to check the reusability of same instance handler with a new request of same type. |
The built-in HTTP handlers in ASP.NET are as follows:
| Handler |
Description |
| ASP.NET page
handler (*.aspx) |
It is the default HTTP handler for all ASP.NET pages. |
| Web service handler
(*.asmx) |
It is the default HTTP handler for Web service pages created as .asmx files in
ASP.NET. |
| Generic Web handler (*.ashx) |
It is the default HTTP handler for all Web handlers that
neither have a UI nor the @ WebHandler directive. |
| Trace handler (trace.axd) |
It is used to display
current page trace information. |
How To Configure HTTP Handlers
ASP.NET stores its configuration information in the following configuration files:
1. machine.config
2. web.config
The machine configuration file, Machine.config, contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory.  Machine.config contains configuration settings for machine-wide assembly binding, built-in remoting channels, and all the web application stored on that computer.
Each web application has its own web.config file. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings.
We can use <httpHandlers> and <add> nodes for adding HTTP handlers to our Web applications. In fact the handlers are listed with <add> nodes in between <httpHandlers> and </httpHandlers> nodes. You can take help of the following example:
<httpHandlers>
<add verb=”[verb list]” path=”[path/wildcard]” type=”[COM+ Class], [Assembly]” validate=”[true/false]” />
<remove verb=”[verb list]” path=”[path/wildcard]” />
<clear />
</httpHandlers>>