Introduction
The life of
an ASP.NET Request introduced HTTPHandlers (among other things) and
you found out that everything eventually gets sent to an HTTPHandler
(even the Page object) is an HTTPHandler. This article will look
at HTTPHandlers in-depth an the creation and use of them, it will also
take a look into HTTPHandler files (ASHX files).
Their Purpose in Life
All an HTTPHandler does really is take an
HTTPContext object and work out what to do with it. Although that is a
very simple analogy of them. The best way to describe it would be with an
example -
Usually you associate an HTTPHandler
with either a new file type (eg. ".AGASP") or with a .ASHX file. In the
pipeline, the Handler is called last and when it is called, the appropriate
HTTPHandler is executed. The handler can print information out or analyze
information. The HTTPApplication object will call the HTTPHandler
to process the request and generate a response.
So, for example, I can associate an
HTTPHandler with the .stime extension and get it print out the server time
when called.
They differ from HTTPModules because
they only have one method, one property and no events -
Public Interface
IHTTPHandler
Public ReadOnly Property IsReuseable as Boolean
Public Sub ProcessRequest(context as HttpContext)
End Interface |