Reputation: 59416
The expected order of HttpApplication methods is:
I'm passing through a situation, which throws absolutely no exception, in which, after the Init, it goes directly to ApplicationEndRequest. It doesn't call Application_BeginRequest neither initiates the page life cyle.
What do I do?
Upvotes: 9
Views: 3357
Reputation: 1901
I observed that Application_BeginRequest
is not called when I use the IIS Rewrite Module to return a 301 redirect. The only event I see called in this scenario is Application_EndRequest
.
Here is my rewrite rule from web.config:
<rule name="HTTPS force" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
This is obviously a very specific scenario. Not sure what general rule applies here.
Upvotes: 0
Reputation: 59416
Application_EndRequest
is called but not Application_BeginRequest
when theres an unhandled exception prior to Application_BeginRequest
.
That may be on Application_Start
, the initialization of some module or at Application_Init
Upvotes: 10