Thursday 17 September 2015

ASP.NET Page Life Cycle

ASP.NET Page Life Cycle


When a page is requested by the user from the browser, the request goes through a series of steps and many things happen in the background to produce the output or send the response back to the client. The periods between the request and response of a page is called the "Page Life Cycle".
  • Request: Start of the life cycle (sent by the user).
  • Response: End of the life cycle (sent by the server).
There are seven stages that occur during the Page Life Cycle before the HTML Response is returned to the client.

(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 stage, 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 IsPostBackproperty. The page also sets the UICulture property.

(3) Initialization

During page initialization, controls on the page are available and each control's UniqueID property is set. A master page and themes are also applied to the page if applicable. 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) Postback event handling

If the request is a postback, control event handlers are called. After that, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page.
 (There is an exception to this sequence: the handler for the event that caused validation is called after validation.)

(6) Rendering

Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to theOutputStream object of the page's Response property.

(7) Unload

The Unload event is raised 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 cleanup is performed.




34 comments:


  1. Thanks for sharing the knowledgeable stuff to enlighten us no words for this amazing blog.. learnt so many things I recommend everyone to learn something from this blogger and blog.. I am sharing it with others also
    IT Software Training in Chennai | Python Training in Chennai | Dot Net Training in Chennai |Android Training in Chennai

    ReplyDelete
  2. 36159DakotaBDDDF15 April 2024 at 16:42

    578EC
    ----
    matadorbet
    ----
    ----
    ----
    ----
    ----
    ----
    ----

    ReplyDelete

Factorial of a Number

Recently Viewed