We use quite a few HttpHandlers in the Haulix codebase. If you are running in IIS 7 Integrated Pipeline Mode, then registering your handler is trivial. In the web.config file, find the system.webServer node and add a line to the handlers section.<handlers> <add name="SampleHandler" verb="*" path="SampleHandler.new" type="SampleHandler, SampleHandlerAssembly" resourceType="Unspecified" /> </handlers>I had a situation in a different website where I was running in IIS 7 Classic Mode. Registering a handler requires a few more steps. Most of the HttpHandler articles I found online referenced using the .ashx extension and the WebHandler directive, which can be called directly without having to setup the web.config or IIS file extension mappings. So, I hope this will help others who have had a hard time finding the solution. For this to work, you have to define both an httpHandlers element AND a handlers element in the web.config. The lines in red are important and are what threw me off the first time.<configuration> <system.web> <httpHandlers> <add verb="*" path="SampleHandler.new" type="SampleHandler, SampleHandlerAssembly" /> </httpHandlers> </system.web> <system.webServer> <add name=SampleHandler" verb="*" path="SampleHandler.new" Modules="IsapiModule" scriptProcessor="C:Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" /> </system.webServer></configuration>
Tags: asp.net
Get notified when a new post is published.