In ASP. NET, how do events occur in sequence ?, ASP. NET event?

Source: Internet
Author: User

In ASP. NET, how do events occur in sequence ?, ASP. NET event?

This article introduces the event execution sequence in ASP. NET through practical methods.

Method/step

Create a C # WebForm project, such:

Add a Button control in the Defualt. aspx file and name it "Button1". Then add an event handler for each event of the control and add a breakpoint, for example:

Open the Global. asax file and add breakpoints, such:

Open the code file Site. Master. cs of Site. Master and add breakpoints, such:

Run the code by running F5: Application_Start → Session_Start → button?init → Page_Load (Defualt. asp) → Page_Load (Site. Master) → button?load → button=prerender → button=unload → display interface.

When we disable IIS, run Session_End → Application_End.

Summary:

1. Execute the Application_Start function when you start a website through IIS and the Application_End function when you close the website. These two functions can be considered called by IIS.
2. When a new connection request arrives, the Session_Start function can be used. When the user does not operate for a long time and exceeds the Session duration, the Session_End function is executed. These two functions can also be viewed as called by IIS.
3. When requesting An aspx page, the Init function of all controls will be executed first, and then the Page_Load function of the page will be executed. If there is a motherboard, The Page_Load function of the motherboard will be executed again, then, execute the Load function, PreRender function, and Unload function of the control. After all the server controls execute these functions, the corresponding interface is displayed.

Now you have a rough idea about how events occur in ASP. NET in sequence, and hope to help you learn the sequence of event execution in Asp. Net.

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.