The following text from the book I am reading is “MCTS Self-Paced Training Kit (exam 70-515),“ Developing Web Applications with ASP.NET 4, ”which gives a brief summary of the application’s life cycle.
- The user first makes a request to a page on your site.
- The request is sent to the processing pipeline, which redirects it to the ASP.NET runtime.
- ASP.NET runtime creates an instance of the ApplicationManager class; this class instance is a .NET framework domain that will be used to execute queries for your application. The application area isolates global variables from other applications and allows each application to load and unload separately if required.
- After creating the application domain, an instance of the HostingEnvironment class is created. This class provides access to items within the hosting environment, such as directory folders.
- ASP.NET creates instances of the core objects that will be used to process the request. This includes the HttpContext, HttpRequest, and HttpResponse objects.
- ASP.NET creates an instance of the HttpApplication class (or the instance is reused). This class is also the base class for Global.asax files. You can use this class to capture events that occur when your application starts or stops. When ASP.NET creates an instance of HttpApplication, it also creates modules configured for the application, such as SessionStateModule.
- , ASP.NET pythline HttpApplication. , URL-, ..
Global.asax:
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
Application["UsersOnline"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application["UsersOnline"] = (int)Application["UsersOnline"] + 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["UsersOnline"] = (int)Application["UsersOnline"] - 1;
Application.UnLock();
}
</script>
? ? , . , " " AppDomain, AppDomain , . - , IIS Applicaiton, HttpApplication AppDomain? .