Tag Archives: HttpHandler

HttpHandlers

Using http handlers we can add new functionalities to Web Server. Files with new extensions like .text for a text file can be handled by Web Server by using http handlers. The future of customization can lead to hosting .jsp pages in IIS by finding adequate ISAPI extensions.

To create customized http handler we need to Create a C# class library as “Examplehandler” and implement IHttpHandler interface.

eg: maps all HTTP requests for files with file name extension .New to the class MyHandler.New

<configuration>
   <system.web>
      <httpHandlers>
         <add verb=”*” path=”*.New” type=”MyHandler.New,MyHandler”/>
      </httpHandlers>
   <system.web>
</configuration>

eg: To configure Web services to enable calls from Ajax enabled client script, we need to register the ScriptHandlerFactory HTTP handler in web.config.

<httpHandlers>

   <remove verb=”*” path=”*.asmx”/>

      <add verb=”*” path=”*.asmx” validate=”false”     type=”System.Web.Script.Services.ScriptHandlerFactory,     System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>

</httpHandlers>

Firstly you need to remove the default httphandler assigned to *.asmx

Advertisements

Leave a comment

Filed under .Net