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

MCAD/MCSD Notes: Chapter 3, Lesson 3; Maintaining State Information

Lesson 3: Maintaining State Information

The purpose of this lesson is to introduce stateful web programming to former VB6 users, to reassure ASP "classic" programmers that ASP.NET backwards compatibility is robust and other stuff beyond my scope of awareness.

These are the "levels of state": Context.Handler object state, Query strings state, Cookies state, View state, Session state and Application state.

This is done with the Context.Handler object. For more information about this design pattern, see MSDN article "Passing Values Between Web Forms Pages" here:

http://msdn.microsoft.com/library/
    en-us/vbcon/html/vbtskpassingvaluesbetweenwebformspages.asp

It may help the reader to mention that the Context object is a member of the Page object when the Page object was first introduced in Chapter 3, Lesson 3. The Context object is of type System.Web.HttpContext.

This quote opens up the way toward realizing that much of the ASP.NET state information is ultimately limited to two types, string and object. What is not suggested in this lesson is the possibility of storing state in user-defined static members of the Application object. I will assume that this is an "advanced topic" and that backwards compatibility is more important in this lesson than moving on to new object-oriented designs.

Instead of this "advanced topic," the first code listing of this lesson clearly shows that the Context1 type, extending System.Web.UI.Page, exposes the string type Value that can be accessed by the Context2 type (in the second code listing). It follows that this lesson shows that strongly typed Page-level state information can be passed (as long as it can be represented by strings).

The following quotes highlight the known issues associated with ASP.NET designs based on Application and Session states:

For more information, see MSDN article "ASP.NET Session State" here:

http://msdn.microsoft.com/library/en-us/dnaspnet/html/asp12282000.asp

See also "<sessionState> Element" here:

http://msdn.microsoft.com/library/
    en-us/cpgenref/html/gngrfSessionstateSection.asp
mod date: 2005-03-15T22:17:23.000Z