You are on page 1of 4

Common Steps in an ASP.

NET Page's Life Cycle


Ive been sifting through code written in Whidbey lately, and noticed that there have been a lot of new events added to the page life cycle of an ASP.NET 2.0 webpage, as opposed to the page life cycle of an ASP.NET v1.1 page. Since Whidbey is still in Beta (and therefore always subject to change), and since I am somewhat apprehensive about learning new functionality that may never get released, I drew up a basic diagram as well as a list of common tasks that occur during the lifecycles of both ASP.NET v1.1 and v2.0 pages, to use as an easy reference. Being the technical simpleton that I am, I chose to keep the diagram and list uh simple :). Below the diagram is the list of common tasks that are performed during a pages life cycle in ASP.NET 1.1 and 2.0:

1. Start HTTPRuntime

Global.asax is parsed and compiled.

PreInit

Check for IsPostback. Create or recreate dynamic controls. Set the Master page dynamically. Set the StyleSheetTheme property. Set the Culture property. Read or set the Profile property values.

2. Page Initialization Page_Init


Read or change Control properties. Setup handlers for events. Load external template files.

LoadViewState()

Load application persistent information to controls. Specify how ViewState is stored. Specify how ViewState is mapped to the internal state.

3. Load Page_Load

If this is the pages first time being processed, then perform initial databinding. Read and update control properties.

4. Validation Validate()

Validate information assigned to validation controls.

5. Event Handling Page_DataBinding()

Bind data sources to controls.

Page_PreRender

Make final modifications to the page Change the control tree structure.

SaveViewState() 6. Rendering Page_Render


Make changes to the HTML of a page. Write text for controls on a page.

7. Unload Page_Dispose

Discard objects used in the page, including the Page object.

Page_Unload

Close open files. Close open database connections. Finish logging or other request-specific tasks.

You might also like