What is HttpHandler

HTTPHandlers are integral components of the ASP.NET web application server responsible for handling specific requests based on file extensions. These handlers operate as processes that execute in response to incoming requests made to an ASP.NET website. Implementing the System.Web.IHttpHandler interface, an HTTPHandler is a class that can serve as the target for incoming HTTP requests.

Functioning as extension-based processors, HTTPHandlers are tasked with fulfilling requests originating from web browsers, depending on the specific file extensions involved. When an HTTPHandler receives a request from a browser, it examines the file extension to determine if it is capable of handling the request, subsequently executing predefined steps to generate an appropriate response.

ASP.NET framework

The ASP.NET framework provides several default HTTP handlers, with the most commonly encountered being the ASP.NET page handler designed for processing .aspx files. These default handlers streamline the handling process for various file types and contribute to the seamless operation of ASP.NET web applications. Following are some default Handlers:

httphandler

How to implement HTTPHandler ?

Any class that implements the IHttpHandler interface can perform as a target for the incoming HTTP requests. The class should have a method ProcessRequest and a property called IsReusable.

C# Source Code
public class MyHandler :IHttpHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { context.Response.Write("Handler Here...."); } }
VB.Net Source Code
Public Class MyHandler Implements IHttpHandler Public ReadOnly Property IsReusable() As Boolean Get Return False End Get End Property Public Sub ProcessRequest(context As HttpContext) context.Response.Write("Handler Here....") End Sub End Class

Conclusion

IsReusable property return either true or false in order to specify whether they can be reused and ProcessRequest is called to process http requests.