Search code examples
asp.netvisual-studio-2010httpmodule

how to add a httpmodule codeblock to my asp.net web app?


i have a solution with a web application that i want to creat a new http module for and cant find a way in the VS2010 IDE to add a httpmodule.

im trying to right click and add new item but don't find httpmodule listed.


Solution

  • And HTTP Module is a class implementing IHttpModule. Just reference System.Web.dll and use System.Web namespace, implement the interface and this is everything you need!

    Well, you'll need to add an entry in "modules" in your Web.config:

    Do so by adding a child "httpModules" elements in system.web node:

    <httpModules>
      <add name="Blah" type="Assembly qualified name of HTTP Module class [namespace.type, assembly]"/>
    </httpModules>
    

    And in system.webServer child "modules" element:

    <modules>
      <add name="Blah" type="Assembly qualified name of HTTP Module class [namespace.type, assembly]"/>
    </modules>