What is ASHX file ?
A file with the ASHX file extension is an ASP.NET Web Handler file. A handler is responsible for fulfilling requests from a browser. ASHX files are used as supporting files in ASP.NET programming and can be opened with any program that codes in ASP.NET. These generic handlers have an extension of ASHX like "filename.ashx". Requests that a browser manages are either handled by file extension or by calling the handler directly. Only one handler can be called per request. A handler does not have any HTML static text like .aspx or .ascx files. A handler is a class that implements the IHttpHandler interface. If you need to interact with any Session information, you will also need to implement IRequiresSessionState. If you want to make an asynchronus handler, you will need to implement the IHttpAsyncHandler interface instead of the IHttpHandler interface.
HttpHandlers have a specific use and are not used in every situation..
What is a HttpHandler?
Well a HttpHandler is used in situations where you need to
"handle" the "http" request sent to your webserver in a
specific or different manor. More over a Http Handler (which is the basis of
all .Net managed handlers) opens up the RAW http request (and response)
allowing for complete customization in dealing with the request and providing a
customized response.
When you use a HttpHandler ?
A Http Handler (as said above) simply recieves and responds to a http
request. Typically we use our .net (aspx) pages to handle and respond to these
request. However when it comes to specific situations, IE. request for
downloading a file, displaying a chart image etc... It is usually better to
remove all the "un needed" events, data and sub routines required to
show a full page. Http Handlers can also provide a low level access to events
and data from all http requests. This allows you to "intercept" http
requests and process data \ header information before your application
processes the request.
Where can they be configured ?
HttpHandlers can be configured in the web.config file.
To configure you can add handler as
<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx"
type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
...
<system.web>
</configuration>
More details
http://www.developerfusion.co.uk/show/4704/2/
Check Michael's blog about .ashx extension
http://weblogs.asp.net/mschwarz/archive/2006/04/03/Missing-.ASHX-Mapping-will-stop-Ajax.NET-running.aspx