General Page Life-cycle Stages

General Page Life-cycle Stages

       In general terms,the page goes through the stages outlined in following table,In addition to the page life-cycle stages,there are application stages that occur before and after a request but are not specific to a page。

1.Page request:The page request occurs before the page life cycle begins,when the page is requested by a user,ASP.NET determines whether the page needs to be parsed and compiled(therefore beginning the life of a page),or whether a cached version of the page can be sent in response without running the page。

2.Start:In the start page,page properties such as Request and Response are set。At this stage,the page also determines whether the request is a postback or a new request and sets the IsPostBack property。Additionally,during the start step,the page’s UICulture property is set。

3.Page initialization:During page initialization,controls on the page are available and each control’s UniqueID property is set。Any themes are also applied to the page。If the current request is a postback,the postback data has not yet been loaded and control property values have not been restored to the values from view state。

4.Load:During load,if the current request is a postback,control properties are loaded with information recovered from view state and control state。

5.Validation:During validation,the Validate method of all validator control is called,which sets the IsValid property of individual validator controls and of the page。

6.Post back Event handling:If the request is a postback,any event handlers are called。

7.Rendering:Before rendering,view state is saved for the page and all controls。During the rendering phase,the page calls the Render method for each control,providing a text writer that writes its output to the OutputStream of the page’s Response property。

8.Unload:Unload is called after the page has been fully rendered,sent to the client,and is ready to be discarded。At this point,page properties such as Response and Request are unloaded and any cleanup is performed。

For more information,See http://msdn2.microsoft.com/en-us/library/ms178472.aspx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章