When does Application_Start() and Application_End() Used?
These two methods will declare in Global.asax file as shown below
public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { //Any Initializations of resources before calling any functionality } protected void Application_End() { //Release of resources before unloading the application } }
Application_Start() method is called when the first resource of the application is requested and it is called once for the application. There is no “user perspective” in this. Just load/create stuff needed for the application to function.
Similarly, Application_End() method is called only once, before the application is unloaded. Use it to dispose of resources.