0

I've got a custom Http module which adds a header to the request depending on the content of the request. This header should be used to rewrite the URL with UrlRewrite rules.

Now my problem is, that my custom HTTP module gets executed after the UrlRewrite module. I've already removed and added the HTTP module after the customer HTTP module in web.config.

<system.webServer>    
<modules>
  <remove name="RewriteModule"/>
  <add name="CustomHeaderSetter" type="ProxyTest.CustomHeaderSetter, ProxyTest" />
  <add name="RewriteModule"/>
</modules>
</system.webServer>

Is there a way to run HTTP modules in a specific order? Or do I have another option to intercept the request before UrlReqrite?

Hamed Moghadasi
  • 1,523
  • 2
  • 16
  • 34
flost
  • 51
  • 1
  • 3
  • Merely changing the order of modules is useless, as modules are called first based on the events they subscribe to, and then the order in configuration. If your module does not hook to the right events, it cannot go ahead of URL Rewrite module. – Lex Li Feb 24 '20 at 19:07
  • I've subscribed to the BeginRequest event, which should be the first event in pipeline. [link](https://stackoverflow.com/a/441460/954427). – flost Feb 25 '20 at 08:28

0 Answers0