Global Asax Events Explained
Application_Init: Called when the application is initialized or called first. It is called for all instances of the HttpApplication object.
Application_Disposed: Fired immediately before destroying the application. It is an ideal place to clean previously used resources.
Application_Error: Raised when an unhandled exception is thrown in the application.
Application_Start: Called when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible to all instances of HttpApplication.
Application_End: Called when the last instance of the HttpApplication class is destroyed. It only starts once during the life of the application.
Application_BeginRequest: Called when an application request is received. This is the first event that fires for a request, which is often a page request (URL) that a user enters.
Application_EndRequest: The last event fired to request an application.
Application_PreRequestHandlerExecute: Fired before the ASP.NET page structure begins to execute an event handler, such as a page or web service.
Application_PostRequestHandlerExecute: Invoked when the ASP.NET page structure is completed executing an event handler.
Applcation_PreSendRequestHeaders: Fired before the ASP.NET page structure sends HTTP headers to the requesting client (browser).
Application_PreSendContent: Fired before the ASP.NET page structure sends content to the requesting client (browser).
Application_AcquireRequestState: Called when the ASP.NET page structure receives the current state (session state) associated with the current request.
Application_ReleaseRequestState: Called when the ASP.NET page structure completes the execution of all event handlers. This leads to the fact that all state modules retain their current state data.
Application_ResolveRequestCache: Called when the ASP.NET page structure completes the authorization request. It allows you to cache modules for servicing a request from the cache, thereby bypassing the execution of the handler.
Application_UpdateRequestCache: Called when the ASP.NET page structure completes the execution of the handler to allow caching modules to store responses that will be used to process subsequent requests.
Application_AuthenticateRequest: Called when the security module has set the current username to be valid. At this point, the user credentials have been verified.
Application_AuthorizeRequest: Fired when the security module confirms that the user can access resources.
Session_Start: Called when a new user visits the application’s website.
Session_End: Dismissal when a user session ends, ends, or leaves the application website.