Wednesday, January 19, 2011

Register Custom HTTP Handlers

We comes across scenarios where we need to build Custom HTTP handlers, ASP.NET calls this HTTP Handler in order to serve a specific request for resources that have a particular extension. Registering a HTTP Handler depends with the versions of IIS. All of us might have looked at the Web.config file which contains the sections and .

Let’s walkthrough on registering the handlers in IIS 6.0 & earlier versions and IIS 7 & later versions. Basically section is used for IIS 6.0 settings and is used for IIS 7.0 and later ones. Again for IIS 7.0 we have two different cases as the settings are different for Classic mode as well as integrated mode.

HTTP Handler for IIS 6.0:

We need to add the handler reference under the section under section.

The task is not yet completed yet as you need to configure the same in IIS as well. Here you can see that if a request comes for any file with extension .MyFileExtension , it gets route to the MyFile class placed inside the App_Code folder.

HTTP Handler for IIS 7.0:

The main difference in adding handlers in IIS 7.0 is that you need to add the reference under the section in the config file. Again here we come across two different scenarios as depends how IIS is running in Classic mode or Integrated mode.

Here scriptProcessor refers to the actual path to the aspnet_isapi.dll file.

· If we are running IIS in Classic mode, you need to enter the reference in both sections like and section as well.

· If we are running IIS in Integrated mode, you need just to enter the reference only in section alone. But here you have to place the reference under the section.


1 comment:

  1. I think, now we could also register programmatically.

    Ta,
    Rajeesh

    ReplyDelete

Installing ASP.NET MVC

Installing ASP.NET MVC Before we dive deep into the ASP.NET MVC, let’s install it our development machine. This is very straight forwa...