ASP.NET Application Life Cycle

ASP.NET Life Cycle:

Working with ASP.Net applications requires working with the application’s life cycle and handling the appropriate events in the application’s lifecycle. When an ASP.NET page executes, it undergoes a life cycle that includes various stages.

Life Cycle of ASP.NET:

In ASP.NET, a WEB page has an execution Life-Cycle that includes 8 phases:

ASP.NET Application Life Cycle

1. Page Request: When a page is requested by the user, ASP.NET parses and compiles that page.

2. Start: In this stage, page properties such as Request and Response are set. It also determines the Request type.

3. Initialization: During this stage, we can access the controls on the page but the control’s ViewState has not yet been initialized.

4. Load: In case of a postback, the control’s properties have been initialized from the ViewState.

5. Validation: Sometimes, there can be some validation set on the form.

6. Control Events: In the case of a postback, the control’s events are called.

7.Rendering: During the rendering stage, the page calls the Render method for each control and thus each control generates the HTML output that is merged with the resulting HTML of the page.

8. Unload: In this stage, the generated page output has already been sent to the client and the page can be discarded.