ASP.NET WebForms Application Event Life Cycle

by Oliver 8. October 2012 23:56

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!

enjoyed the post?

Tags:

Comments are closed

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for javascript. Enjoy MVC 4 and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our children. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.