Ironing code, geek t-shirts and even presentations!

Http handlers is a really elegant infrastructure allowing you to provide special behavior to specific paths in your application. You can use them to create RSS feeds, dynamically generate images, handle requests differently and more.

Apart from writing new http handlers, there are some built-in handlers that you can take advantage of. The built in handlers are separated into three categories (in my opinion at least): request handlers, error generators and misc. handlers.

Request Handlers

These handlers process requests in a specific way. Although these already have paths configured for them, you can manually configure them in the web.config (or via IIS Manager) to run on different paths. For example, treat ABC files the same as ASPX files. There is one catch here – because ASPX, ASHX and ASMX files are dynamically compiles, you will also need to provide build configurations for the new extensions.

The following web.config sample enables accessing trace info via MyTrace.aaa (this is web.config configuration for IIS 7 running in Integrated mode, in other versions or modes the configuration will be a bit different):

Miscellaneous

The misc. category contains one handler, the static file handler, which can help in various scenarios. It will present the file content without any processing. With this handler you can, for example, enable users to retrieve lkr file (no special meaning to this extension that I know of) content.

Static file – shows the content of a file without any processing - System.Web.StaticFileHandler.

The following sample configures lkr files to be processed by the static file handler. To test this, create a txt file in your web application root folder, rename its extension to lkr and navigate to it.

I am a passionate web-head, AngularJS fanboy, Microsoft C# MVP and the author of "IronRuby Unleashed". To make a living I consult, train and code at CodeValue. I also speak at conferences around the world.

Apart from technology, I'm a wannabe guitarist and a sports junkie - both doing and watching. Especially basketball. And I also snowboard once in a while.