Asp. NET of application

Source: Internet
Author: User
Tags root directory
Application|asp.net in asp.net application usage is the same as the ASP, almost nothing to say, but it has two more particularly useful events, Application_ OnBeginRequest and Application_onendrequest. Their same as the original Application_OnStart and Application_OnEnd are placed in the global file (note that this file in the ASP name is Global.asa, in ASP.net is global.asax).



Note: This event, write not write on is the same. Like Application_End and Application_OnEnd are the same



Application_OnStart is the first event that is triggered in the entire ASP.net application, which is triggered when the first ASP.net program executes in a virtual directory, and Application_OnEnd is just the opposite. is triggered when the entire application is stopped (usually when the server is restarted/shutdown). Application_onrequeststart and application_onrequestend occur when every ASP.net program is requested, which means that the client accesses one ASP.net program at a time, and the two events are triggered. We can see his application from the following procedure. We first set up a global.asax, which reads as follows:



<script language= "C #" runat= "Server" >



void Application_onbeginrequest (Object sender, EventArgs E)
{
Response.Write ("Request is starting...<br>");
}



void Application_onendrequest (Object sender, EventArgs E)
{
Response.Write ("Request is ending...<br>");
}



</script>



Then put it in the root directory of this virtual directory, and then we'll open a random aspx file
The statement we defined in Global.asax is starting ... and request is ending ... This is not the one we added to this file, and we will see its shadow in any asp.net file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.