For a long time, I kept looking at the possible application events here: http://www.techrepublic.com/article/working-with-the-aspnet-globalasax-file/5771721. It’s been a valuable resource many times, but today I wanted to figure out in which order events are fired. The post actually contains an ordered list but at least for ASP.NET 4 it seems to be a bit incorrect. Here is what I came up with using a small HttpModule and a really simple page to log the events. I’ve also marked inside which event handlers you can access Session state:
BeginRequest: Session null
AuthenticateRequest: Session null
PostAuthenticateRequest: Session null
AuthorizeRequest: Session null
PostAuthorizeRequest: Session null
ResolveRequestCache: Session null
PostResolveRequestCache: Session null
MapRequestHandler: Session null
PostMapRequestHandler: Session null
AcquireRequestState: Session not null
PostAcquireRequestState: Session not null
PreRequestHandlerExecute: Session not null
PostRequestHandlerExecute: Session not null
ReleaseRequestState: Session null
PostReleaseRequestState: Session null
UpdateRequestCache: Session null
PostUpdateRequestCache: Session null
LogRequest: Session null
PostLogRequest: Session null
EndRequest: Session null
PreSendRequestContent: Session null
PreSendRequestHeaders: Session null
Happy eventing!