Search code examples
asp.nethttpmodule

custom HttpModule doesn't work in vs 2012


I programmed a custom HTTPModule through implemnting IHttpModule interface.Then i registered it in web.config file

<configuration>
  <system.web>
    <httpModules >
      <add name="AuthHttpModule" type="AuthHttpModule" />
    </httpModules>
  </system.web>
</configuration>

but it's throw an error when i try to access any page

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Note: I'm using VS2012 and C#.


Solution

  • If you are using Integrated mode configure you handlers & modules inside system.webServer instead of system.web.

    <configuration>
        <system.webServer>
          <handlers>
    
          </handlers>
          <modules>
    
          </modules>
        </system.webServer>
    </configuration>
    

    Or

    If you want to use you existing setting you can use "Classic Mode" for that.