Introduction to ASP.Net

  • 2020-06-15 08:07:34
  • OfStack

In ASP.Net, the Application usage is the same as ASP, hardly saying anything, but it adds two particularly useful events, Application_OnBeginRequest and Application_OnEndRequest. They and the original Application_OnStart and Application_OnEnd1 are in the global file (note that this file is named global.asa in ASP and global.asax in ASP.Net).

Application_OnStart is the first event to be triggered by the entire ES25en.Net application, that is, when the first ES27en.Net program in 1 virtual directory executes, and Application_OnEnd, by contrast, is triggered when the entire application stops (usually when the server is restarted/shut down). Application_OnRequestStart and Application_OnRequestEnd occur every time an ES35en.Net program is requested, that is, a customer visits an ES37en.Net program once, and both events are triggered. We can see his application from the following program. We first set up an ES39en.asax, which is as follows:


 The < script language="C#" runat="server" >  
void Application_OnBeginRequest(Object sender, EventArgs E) 
{ 
Response.Write("Request is Starting... The < br > "); 
} 
void Application_OnEndRequest(Object sender, EventArgs E) 
{ 
Response.Write("Request is Ending... The < br > "); 
} 
 The < /script >  

Put it in the root of this virtual directory, and open whatever aspx file you want
The statement we defined in ES46en. asax Request is Starting... And Request is Ending... This is not the only one we added to this file, we will see it in any 1 ASP.Net file.


Related articles: