Saturday, July 21, 2007

General Page Life-Cycle Stages

Page Request
Page request occurs before page lifecycle begins
When the page is requested by a user, ASP.net determines whether the page needs to be parsed and compiled or send a cached version

Start
In the start step, page properties such as Request and Response are set
Page also determines whether the request is a postback or a new request
Sets the IsPostBack property
Sets the UI culture

Page Initialization
Controls on the page are available
Each control’s unique ID property is set
Theme is applied
If current page is a postback, the data is not yet loaded
Values are not restored from viewstate

Load
If page is a postback, control properties are loaded
Information from viewstate is recovered

Validation
Validate method of all the controls is called

Postback Event Handling
If page is a postback, eventhandlers are called

Rendering
Before rendering, viewstate is saved for the page and all the controls
During this stage, page calls Render method for all the controls
Providing a text writer to write output to the page’s Response property

Unload
Unload is called when page has finished rendering
Page properties such as Request/Response

No comments: