14.1. Understanding State in .NET

If you are working with state management in your Web application, it is important to understand state as it works within .NET as a whole. The .NET Framework and ASP.NET provide a plethora of options in dealing with state. Some of your server-side options are described in the following table.

Session TypeDescription
ApplicationUsing the Application object, you can store state that is applicable to all users. You are unable to use this for providing different state options to different users.
CacheUsing the Cache object, you are able to also store state for every user of the application. This object supports the ability to expire the cache and it also provides the ability to set dependencies on how the cache is expired.
Database-driven SessionA means of using the Session object and having all the state stored safely on a SQL server.
SessionUsing the Session object, you are able to store state on the server on a per user basis. The Session object allows you to store the state in-proc (in the same process as the application), out-of-proc (in a different process), or even using the aforementioned database approach.

If it were all about the server-side options, it would not be that long of a story to tell. ASP.NET also includes a good list of client-side state management techniques that make the process of storing state rather easy. The following table defines your client-side options.

Session TypeDescription
ControlStateA means of providing state to controls ...

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.