Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application_End global.asax

Can anybody tell me when Application_End is triggered in a lifecycle of an application? When all sessions are ended, will Application_End be triggered automatically? + Are there any other reasons why Application_End could be triggered?

like image 530
Lieven Cardoen Avatar asked Nov 13 '08 21:11

Lieven Cardoen


People also ask

Is global ASAX mandatory?

asax is not required by ASP.NET for a website to run. It is, however, very useful for application-level functionality (like unhandled exception logging).

What is global ASAX used for?

Global. asax is an optional file which is used to handling higher level application events such as Application_Start, Application_End, Session_Start, Session_End etc. It is also popularly known as ASP.NET Application File. This file resides in the root directory of an ASP.

What is Application_EndRequest?

Application_EndRequest() : Occurs with each request the application receives, just after the page code is executed. Session_Start() : Occurs whenever a new user request is received and a session is started. Session_End() : Occurs when a session times out or is programmatically ended.


1 Answers

The application_end event primarily fires when the IIS pool is recycled or the application itself is unloaded. One other thing to note, that a change to a dependent file (say web.config) will cause the application to reload itself, which will in cause the application_end event to fire while it is closing itself off.

To note, the only instance I found of the application end event firing when the last user session times out is in some old documentation dated 2001. I'm not sure if that criteria still applies.

like image 183
Dillie-O Avatar answered Sep 30 '22 02:09

Dillie-O