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:
Handle Postback Events
Load View State
Button Click Handler
Process Postback Data
Send Postback Change Notifications
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:
The next time you try to access ViewState during the Init event, you'll know why it doesn't work correctly.