Hanselman’s Interview: HTTP Handlers

What are ASHX files?  What are HttpHandlers?  Where can they be configured?

An .ashx file is a placeholder for an HttpHandler. It allows you to create a IHttpHandler implementation as simply as you create a .aspx file, without any reconfiguration of web.config or other hoops. It provides you access to the Request and Responsie without any of the facilities or overhead of the page model.

HttpHandlers are low level implementations of the request/response http cycle. Using an HttpHandler, you can deliver responses back to the browser with minimal overhead. A good example of this would be a dynamic image generator that could be accessed using the <img> tag.

You configure HttpHandlers by registering them in web.config. You may also need to configure IIS to send certain file extension requests to aspnet_isapi.dll.