Welcome, Guest • Great software is not cheap to make.

ASP.NET global.asax Events Sorted Order

Views: 4777 | Like2 | Comments: 0
In an ASP.NET application, the lifecycle events within the Global.asax file occur in a specific sequence from the beginning to the end of the application and request lifecycles. Here is the sorted order of events based on their typical execution timeline:
  1. Application_Start: Triggered when the application starts, once per application lifecycle.
  2. Session_Start: Occurs when a new session is created for a user.
  3. Application_BeginRequest: Fired at the beginning of each request.
  4. Application_AuthenticateRequest: Occurs when the application attempts to identify the user.
  5. Application_AuthorizeRequest: Triggered to determine if the identified user is authorized to proceed.
  6. Application_ResolveRequestCache: Fired when the application tries to serve the request from the cache.
  7. Application_AcquireRequestState: Occurs when the application acquires the current state associated with the request.
  8. Application_PreRequestHandlerExecute: Triggered before the ASP.NET page framework begins executing the event handler for the request.
  9. Application_PostRequestHandlerExecute: Fired after the event handler has been executed but before the result is sent to the client.
  10. Application_ReleaseRequestState: Occurs when the application completes execution of all event handlers, allowing state modules to save their state data.
  11. Application_UpdateRequestCache: Fired to update the cache with the response, if applicable.
  12. Application_PreSendRequestHeaders: Triggered just before the HTTP headers are sent to the client.
  13. Application_PreSendContent: Occurs just before the content is sent to the client.
  14. Application_EndRequest: The last event fired for each request, used for cleanup tasks.
  15. Session_End: Triggered when a session ends, either due to timeout or the user leaving the application.
  16. Application_Error: Can occur at any point during the application lifecycle when an unhandled exception happens.
  17. Application_Disposed: Occurs just before the application instance is destroyed. Typically not used in most applications but available for cleanup logic.
  18. Application_End: Fired once when the application is ending, typically during a shutdown or restart.
This sequence provides a comprehensive framework for understanding the flow of events in an ASP.NET application from start to finish.

You describe it, I build it

Great software is not cheap to make.
Major Projects
AB953: Racial and Identity Profiling Act Stop Data
Online Services
Merge PDF Files
PrivacyAboutContact