Saturday, August 29, 2020

Major Events in Global.asax File

 

 Global.asax file is derived from the HttpApplication class and contains code for responding to application-level events raised by ASP.NET. Global.asax file, also known as ASP.NET application file, is located in root directory of an ASP.NET application.



Note 1 : The Global.asax is an optional file. Use it only when there is a need for it.

Note 2 : If a user requests the Global.asax file, the request is rejected . External users can not use it.

The following are some of the important events in the Global.asax file:

Application_Init : The Application_Init event is fired when an application initializes the first time.

Application_Start  : The Application_Start event is fired the first time when an application starts.

Application_AutorizeRequest : Application_AutorizeRequest event is  fired on successful authentication of users credentials. You can use this method to authorization rights to user.

Application_ResolveRequestCache : Application_ResolveRequestCache is fired on successful completion of an authorization request.

Application_Disposed : Application_Disposed  event is fired when the web application is destroyed.

Session_Start : Session_Start event is fired when session starts on each new user requesting a page.

Application_BeginRequest :  The Application_BeginRequest event is fired when each time new user request come in.

Application_EndRequest : The Application_EndRequest event is fired at the end of each request.

Application_AuthenticateRequest : The Application_AuthenticateRequest event indicates that a request is ready to be  authenticated. If you are using forms Authentication, this event can be used to check for the user’s roles & rights.

Application_Error : The Application_Error event fired when an error occurs.

Session_End : The Session_End event is fired when the session of a user ends.

Application_End : The Application_End event is fired when the web application ends.

No comments:

Post a Comment