Monday, August 13, 2007
« Develop ASP.NET Apps under IIS7 on Vista... | Main | Special Guests at pashabitz.com »

ASP.NET provides an easy way to write custom http handlers. You simply implement the IHttpHandler interface and register your handler in the "web.config" section under system.web like this:

<httpHandlers>
  <add verb="*" path="*.my_extension" type="MyHanlders.Handler, MyHandlers" />
</httpHandlers>

This registers a class named Handler to handle requests to URLs with extension ".my_extension".
You still need to let the web server know about this extension, and configure it to pass processing of files with this extension to ASP.NET.

To do it in IIS7, add the following to your web.config, under the "configuration" section:

<system.webServer>
  <handlers>
    <add name="handler_name" path="*.my_extension" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" />
  </handlers>
</system.webServer>

Bookmark and Share Monday, August 13, 2007 9:25:33 PM (Jerusalem Daylight Time, UTC+03:00)  #    Comments [0]