Asp.net MVC error with custom HttpModule

Posted by Robert Koritnik on Stack Overflow See other posts from Stack Overflow or by Robert Koritnik
Published on 2009-07-21T19:45:16Z Indexed on 2010/03/31 3:43 UTC
Read the original article Hit count: 372

I have a custom authentication HttpModule that is pretty strait forward. But I want it to run only for managed requests (and not for static ones).

Asp.net MVC automatically adds configuration section for IIS7 web server:

<system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
   <modules runAllManagedModulesForAllRequests="true">
      <remove name="ScriptModule" />
      <remove name="UrlRoutingModule" />
      <add name="ScriptModule"
           preCondition="managedHandler"
           type="System.Web.Handlers.ScriptModule,..." />
      <add name="UrlRoutingModule"
           type="System.Web.Routing.UrlRoutingModule,..." />
   </modules>
   <handlers>
      ...
   </handlers>
</system.webServer>

When I add my own module I also set its preCondition="managedHandler", but since there's runAllManagedModulesForAllRequests="true" on parent <module> element my preCondition is ignored by design (as I read on MSDN).

When I try to set though:

<modules runAllManagedModulesForAllRequests="false">

I get this error: [image no longer valid]

What else (which other module) do I have to set in web.config to make it work with this setting:

<modules runAllManagedModulesForAllRequests="false">

© Stack Overflow or respective owner

Related posts about iis7

Related posts about asp.net-mvc