Search code examples
asp.netiisurl-rewritinghttpmoduleiis-logs

Which event occurs first, OnAuthorizeRequest of HttpModule or IIS logging


Let me explain the context first.

The below is my understanding so please do not troll me :)

I have a HttpModule which helps in url rewriting on event OnAuthorizeRequest.

So whenever a request comes in with say www.mysite.com/abc/ the module rewrites it to its underlying template say /abcTemplate.aspx using context.RewritePath

Now, when I check my IIS logs i.e. C:\inetpub\logs\LogFiles I am not able to find /abc/ anywhere but a lot of /abcTemplate.aspx

So, a couple of questions

  1. Is /abc/ ever getting logged on IIS. If yes then where?
  2. If no then does that mean that the event in HttpModule occurs before IIS logging?

I found a link here but it does not completely answer my query.

Other than the above, I tried to search on the internet but not getting any relevant results.

Probably I am not typing in the correct keywords.

Please help.

Thanks in advance.


Solution

  • IIS Logging logs the request after the response has been prepared. Check this event life cycle.

    enter image description here

    Source MSDN

    In your case RewritePath is happening first and in a very later stage of the event life cycle the IIS is logging the details.