Chapter 14. State Management

Simply put — building ASP.NET applications is more difficult than other types of applications, such as building a Windows Forms application, mainly because Web applications are a stateless type of application.

The Internet is stateless by nature. You are simply making requests and responses (generally over HTTP). The server receives an HTTP request for a particular page and sends the caller the requested page (the response). The server that is sending the response does not keep track of who made the request. Every request is equal in the server's eyes.

When the same calling application makes a second request, the server gives it the second piece of information but still does not house any information about this calling application. The server does not know that this application is the same one that just recently requested the first piece of logic.

This creates a problem if you want your Web application to remember information about the calling application. Remembering the calling application and being able to make a distinction between requests allows end users to work through an application in a continuous manner. You may want your application to retain certain information: who the users are, their preferences, or any other pertinent information about them as they makes multiple requests. You do this by using varying techniques that you can apply throughout your Web application's code.

One of the common techniques of the past and present is to use ...

Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.