first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

MCAD/MCSD Notes: Chapter 2, Lesson 2; Responding to Events

Lesson 2: Responding to Events

The purpose of this lesson is detail Web application events from the page level to the application level. Dino Esposito further details the sequential, cyclical process of page-level events in "The ASP.NET Page Object Model: One Day in the Life of an ASP.NET Web Page" here:

http://msdn.microsoft.com/library/en-us
    /dnaspp/html/aspnet-pageobjectmodel.asp

This statement does not seem accurate. The assumption here is that the life of a Web application begins when a browser requests any page of the application. This level of accuracy takes into account what some call "deep linking."

When all sessions end the application "ends" but because of .NET Framework garbage collection, "...you don't know when an Application_End event will occur." For more details about Session State, see "Session State" at MSDN:

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconSessionState.asp

This introduction of view state seems to serve only to introduce the words "view state" as the lesson moves on quickly to survey Application and Session "state variables" (yet another term that understandably avoids delving into the object collections of the underlying HttpApplicationState and HttpSessionState classes). More details at MSDN in "ASP.NET State Management" here:

http://msdn.microsoft.com/library/
    en-us/cpguide/html/cpconaspstatemanagement.asp

The assumption here is that C# does not protect the developer against runtime errors caused by strong-typing collections of type object with casting. The code samples on page 3 clearly suggest that VB.NET insulates the developer from such pitfalls.

The following summarizes application-scope event handlers:

Application_Start
Application_End
Application_BeginRequest
Application_EndRequest

Session_Start
Session_End

The following summarizes the page-scope event handlers firing in sequence:

Page_Init
Page_Load
Page_PreRender
Page_Unload
Page_Disposed

The following summarizes the other page-scope event handlers:

Page_Error
Page_AbortTransaction
Page_CommitTransaction
Page_DataBinding

The following summarizes the server control-scope event types:

Postback events (e.g. the Click event)
Cached events (e.g. the TextChanged event; see below)
Validation events (solely of the validation server controls)

The lesson refers to "Cached events" for the sake of completeness but not clarity. This term should not be confused with "cache events": Cache events are not really .NET Framework events but are a design pattern featuring the CacheItemRemovedCallback delegate. This is discussed in detail in Chapter 12, "Optimizing Web Applications with Caching" under "Responding to Cache Events."

Cached events reveal the design goal of the ASP.NET team to try as much as possible to replicate Windows Forms eventing by "postponing" events on the client and processing them later on the server.

mod date: 2004-11-18T01:21:57.000Z