locked
order of IHttpModule execution RRS feed

  • Question

  • User1700351348 posted

    hello everyone!

    i have some problem with modules...

    in my project i'm using both url rewriting and request routing features, but i need to specify the order of module execution.

    in web.config i wrote:

    <system.webServer>
        <modules>
          <add name="UrlRoutingModule" preCondition="integratedMode" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />      
          <add name="UrlRewriterParserModule" preCondition="integratedMode" type="YottosCatalog.Modules.UrlRewriterParserModule"/>
          <remove name="ScriptModule"/>
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>      
        </modules>
    </system.webServer>

    well, as i said, i have two modules.

    i need "UrlRoutingModule" to execute first, and only if no route found, "UrlRewriterParserModule" executes.

    i thought, that order of module execution is the same as the order i'm adding modules

    to web.config, but it's not working - "UrlRewriterParserModule" allways executes first.

    so, is there any way to specify the order of module execution (not in code, but in web.config)?

    Thursday, September 24, 2009 11:38 AM

All replies

  • User-627724879 posted

    Are both modules handling the same ASP.NET events? Or is the one you want to execute 2nd handing an event in the pipeline before the event handler of the one you want to execute 1st? Even if you list them in order int he config that does not change the event pipeline, the events fire in the same order and only once for the request.

    Have you tried changing the order in the web.config to see if that changes things. 

    Monday, September 28, 2009 8:13 AM
  • User1700351348 posted

    Are both modules handling the same ASP.NET events? - yes, excactly the same event "BeginRequest"

    Have you tried changing the order in the web.config to see if that changes things. - yes, i tried, but i didn't help, that's why i started this thread.

    also i thought, that they are executing in alphabetical order, so i renamed them in web.config, so the first one will be UrlRoutingModule,

    but also didn't help.

    now i'm suppressing execution of event handlers programically, so it works, but is there any way to do this in config...

    Monday, September 28, 2009 8:51 AM