Explain the life cycle of an ASP .NET page.

 

Life cycle of ASP.Net Web Form
Page Request >> Start >> Page Init >> Page Load >> Validation >>
PostBack Event Handling >> Page Rendering >> Page Unload
Page Request - When the page is requested ASP.Net determines
whether the page is to be parsed and compiled or a cached verion of the page is to be sent without running the page.

Start - Page propertied REQUEST and RESPONSE are SET, if the
page is pastback request then the IsPostBack property is SET and in addition to this UICulture property is also SET.

Page Initilization - In this the UniqueID of each property is SET.
If the request was postback the data is not yet loaded from the viewstate.

Page Load - If it was a postback request then the data gets loaded in the control from the ViewState and control property are set.

Validation - If any control validation present, they are performed and IsValid property is SET for each control.

PostBack Event Handling - If it was a postback request then any event handlers are called.

Page Rendering - Before this the viewstate is saved from the page and RENDER method of each page is called.

Page Unload - Page is fully rendered and sent to the client(Browser) and is discarded. Page property RESPONSE and REQUEST are unloaded.

 

Shashi Ray