Explain ASP.NET Page life Cycle stages briefly?

ASP.Net webpage execution will perform several steps for processing page; this is called asp.net page life cycle. The steps are

  • Page Request
  • Start
  • Page initialization
  • Page Load
  • Post Back events handling
  • Rendering
  • Unload

Page Request

The page request occurs before the page life cycle begins. When ASP.NET gets a page request, it decides whether to parse and compile the page, or there would be a cached version of the page; accordingly the response is sent.

Starting of a page

In this stage, page properties such as Request and Response objects are set. At this stage, the page also determines whether the request is a PostBack or a new request and sets the IsPostBack property. During this stage, the page's UICulture property is set.

Page Initialization

During page initialization, all controls are available on the page and UniqueID property of every control is set. If page is applicable, Themes and a master page are applied to the page. For a new request, PostBack data is loaded and the control properties are restored to the view-state values.

Page Load

At this stage, if the request is a PostBack, then it loads data from  view state and control state values.

Post Back events handling

If the request is a PostBack, any event handlers are called. After that, the Validate method is called, which sets the IsValid property.

Rendering

Before this stage, view state is and all controls are saved. During this phase, the page calls the Render method for each control and the output of rendering is written to the OutputStream class of the Response property of page.

Unload

This event is raised after the page has been fully rendered and the page is sent to the client with its properties such as Response and Request and cleanup is performed.
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*