Room for reference
August 27, 2004
  ASP.NET 1.1 Page Execution There's probably been plenty written by this time on the execution lifecycle of ASP.NET v1.1 pages. However, I still run into a lot of issues and questions around what order events and methods get executed during the lifecycle of a request. Its essential to understand this order when debugging what can be complex bugs in Page and WebControl code.

Here's a short exercise that will help you internalize whats happening during the creation and execution of a page. Do this without looking up the answer, and it will really make you think through what is happening. Put the following events in order, assuming the request is a PostBack resulting from a Button click:

Unload
Pre-Render
Handle Postback Events
Dispose
Save State
Load View State
Load
Button Click Handler
Process Postback Data
Initialize
Send Postback Change Notifications
Render
You can lookup the answer in MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcontrolexecutionlifecycle.asp, but realize that at least one of the events [Button Click Handler] is out of order in the documentation.

Consider the events in you Global.asax class on the first request received by an application not yet started:

Authorize Request
Application Start
Authenticate Request
End Request
Page Execution
Begin Request
Session Start

The next time you try to access ViewState during the Init event, you'll know why it doesn't work correctly.
 
Comments: Post a Comment

<< Home
a blog on Technology of Microsoft & much more..

My Photo
Name:
Location: Chennai, Tamil Nadu, India
ARCHIVES
May 2004 / June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / September 2005 /


Powered by Blogger