i

ASP.Net A Complete Guide

Application State

The application-level event is written in a special file called Global.asax. This file is not available by default. It needs to create explicitly by the developer in the root directory. In the application, we can create more than one Global.asax file, but only the root one is read by ASP.NET.

Below are the main events from asp.net for application:

Application_start: This event gets started when an application domain starts.  The app domain starts when the first request is raised to an application.

void Application_Start(object sender, EventArgs e)

{

    Application["Name"] = "Varsha";

}

Application_Error: This event raised when an unhandled exception occurs. We can manage that exception by doing the exception handling.

Application_End:

This event is raised before an app domain ends due to any reason. It may be an IIS server restart or make some changes in an application cycle.