This article describes the usage of global application objects in this application. Share it for your reference. The details are as follows:
Application is an application global object and is shared by everyone. No matter which page you use to operate the Application, the other page can read Application information.
Since Application is shared, Lock first before the operation, UnLock after the operation is completed.
Set data on a page:
(); ("address", "Shanghai"); ();
Get data on another page:
string s = (string)("address"); = s;
Add a "global application class" to execute Application_Start when the first page of the application is accessed.
Let’s give examples of “counting visitors” that have been badly mentioned by many books. Every time a content on the server is accessed, Application_BeginRequest will execute and count ++. Why is this not good? Large concurrent access will be very stuck!
Note here: Try not to use Application when developing websites, and there are rarely times when you need to use it.
I hope this article will be helpful to everyone's programming.