In this post, I will explain about the various event that is raised during the life cycle of a web application. Global.asax in Asp.net is used to specify an event handler for some application level event.
Application_Init: This event Fires each time application initializes or is first called. It is invoked for all HttpApplication object instances.
Application_Disposed: This event Fires just before an application is destroyed. This is the suitable location for cleaning up any previously used resources.
Application_Error: This event Fires when an unhandled exception is encountered within the web application.So using this event we can write generic exception handler.
Application_Start: This event is raised when the application first starts up and the application domain is created. This event suitable for to set the rule that remains same till application runs.Ex, Routing rule, navigation tree etc.
Application_End: This event raised just before when web application ends.
Application_BeginRequest: This event is raised at the start of every request within the web application.
Application_EndRequest: This event is raised at the end of the web request and just before the objects are released and reclaimed. As a result, It’s a suitable event for cleanup code.
Application_PreRequestHandlerExecute: This event is raised before the ASP.NET page framework begins executing an event handler like a page or Web service.
Application_PostRequestHandlerExecute: This event is raised when the event handler finish the execution
Applcation_PreSendRequestHeaders: This event is raised when .net framework send the web HTTP header to a respected requesting client(i.e. Browser)
Application_PreSendContent: This event is raised before the ASP.NET page framework sends content to a requesting client (browser).
Application_AcquireRequestState: This event is raised when .net framework gets the current state of the current web request.
Application_ReleaseRequestState: This event is raised when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.
Application_ResolveRequestCache: This event is raised when the ASP.NET web page framework completes the process of an authorization request.
Application_UpdateRequestCache: This event is raised when the ASP.NET page framework completes handler execution
Application_AuthenticateRequest: This event is raised when the security module has established the current user’s identity as valid. At this point, the user’s credentials have been validated.
Application_AuthorizeRequest: This event is raised when the security module has verified that a user can access resources.
Session_Start: This event is raised when a new user visits the application Web site.
Session_End: This event is raised when a user’s session times out, ends, or they leave the application Web site.