Name
IHttpHandler
Synopsis
This interface is required to process HTTP requests. It’s implemented
by the System.Web.UI.Page and HttpApplication classes, but you can use IHttpHandler to create a custom
HttpHandler for a lower-level programming model. You can still access the HttpContext
object (and, through its properties, built in objects like HttpRequest and HttpResponse), but you cannot use the
higher-level Page abstraction. Common uses of
handlers include filters and CGI-like applications, especially those returning binary data.
When using the IHttpHandler interface,
you must implement the ProcessRequest() method and IsReusable property. The ProcessRequest() method
receives an HttpContext object, which
gives you access to ASP.NET’s built-in objects. Use the IsReusable property to
declare whether a single instance of your handler can serve multiple
requests.
You will also need to modify <httphandlers> section
of the web.config file to make your custom handler a
target for HTTP requests. You can map requests based on the requested
page, file type, or HTTP method (GET, PUT, or POST). If you want to
create a handler that can process all
requests, you should create a custom
HttpModule using the IHttpModule interface.
Public Interface IHttpHandler ' Public Instance Properties Public ReadOnly Property IsReusable As Boolean ' Public Instance Methods Public Sub ProcessRequest(ByVal context As HttpContext) End Interface
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access