Home > Articles > Web Development > ASP.NET

State Management with ASP.NET

  • Print
  • + Share This
State management refers to storing or using information received from the client to alter the behavior of an application. This can be as simple as remembering a user's name, or as complex as managing caches of data from a database to share among multiple sessions. In this article, learn the basic concepts of state management with ASP.NET-including the two types of state data, and examples that demonstrate the use of application and state management within an application.
This article is extracted from Chapter 9, "ASP.NET Web Applications," of Sams Teach Yourself ASP.NET in 24 Hours. This material is based on Beta2 release version of Microsoft's .NET technology.
From the author of

This article assumes some background knowledge of ASP.NET's application lifecycle events, and the Global.asax, Global.asax.vb and Web.Config files.

Basic Concepts

State management refers to storing or using information received from the client to alter the behavior of an application. This can be as simple as remembering a user's name or as complex as managing caches of data from a database to share among multiple sessions.

For example, the following line of code stores the current time (obtained from another application) in the application collection with the following line of code:

Application("AppStart") = Date.Now.ToLongTimeString

Name-value pairs may be added directly to the application collection in this manner. These values are global to all instances of the application. This is an example of application state management.

  • + Share This
  • 🔖 Save To Your Account