Store and retrieve application state.
Store and retrieve session state.
Configure session state storage.
Use client-side cookies for state storage.
Most applications of any significance will use pieces of data, or variables, that need to be maintained across a series of requests or shared between multiple users of an application. This data is referred to as state. In a rich client application, it’s relatively simple to maintain individual user state simply by allocating space in memory on the client machine. In Web applications, managing user and application state is more challenging. The primary reason for this is that the Hypertext Transfer Protocol (HTTP)—the protocol used to send and receive requests through a Web browser—is inherently stateless. That is, HTTP doesn’t inherently provide a way for the Web server to identify a series of requests as coming from the same user, making it difficult for the Web server to maintain state and associate it with an individual user.
In classic ASP, this limitation was overcome through an in-memory collection of key-value pairs associated with the intrinsic Session object. This collection, however, had a number of important limitations of its own, which are discussed later in this chapter.
In addition to individual user state, many applications need to store and retrieve application-level state information that is global to all users of the Web application. To maintain application state in classic ASP, the intrinsic Application object exposed a collection similar to that of the Session object’s collection.