Home  >  Article  >  Backend Development  >  Detailed explanation of the life cycle of Web Page

Detailed explanation of the life cycle of Web Page

巴扎黑
巴扎黑Original
2016-12-20 16:33:561610browse

Understanding the life cycle of ASP.NET Web Page is very necessary for an engineer doing WEB development, especially when writing your own control.

The life cycle of ASP.NET Web Page can be basically divided into the following stages:

1. Page request
When this page is requested, it occurs before the web page life cycle. When a page is requested, ASP.NET The engine needs to determine whether this page needs to be compiled or sent directly to the requester through a buffered version of this page.

2. Start
At this stage, Page’s Request, Response, IsPostBack, and UICulture properties are set appropriately.

3. Page initialization
At this stage, the UniqueID attribute of each control is set, and the theme of the page is also applied. If this page is a postback page, that is, the IsPostBack attribute of the Page is true, then the new content of each control in the page The values ​​and ViewState have not been restored at this stage.

4. Load
At this stage, if the page is a postback page, the new values ​​​​and ViewState of each control in the selected page will be restored or set.

5. Validation
At this stage, the verification control in the page calls its own Validate method for verification in order to set its own IsValid property, because the verification control is verified on both the client and server sides.
                    6. Postback event handling                                                                                           out .

7. Rendering
At this stage, Page calls the Render method of each control to write the html text stream corresponding to each control into the OutputStream property of Response. Before this stage, each control will save its own ViewState again, so we There is still one last chance to change the ViewState property of the control in the Page's PreRender method.

8. Unload
At this stage, the entities originally created for the Page and each control will be deleted and the resources will be released.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn