ASP.NET Persistence
Following is a simple table which I came across a post “Nine Options for Managing Persistent User State in Your ASP.NET Application”
Posting it here for easy reference. This lists out various ASP.NET Persistence methods.
Persistence Method | Who Needs the Data? | For How Long? | How Much Data? |
Application | All users | Until the next application restart | Can be almost any size—it will only be stored once |
Cookie | One user | As short as desired, or for months or even years if the user doesn’t delete their cookies | Minimal, simple data |
Form Post | One user | For the next request (can be reused across many requests) | Virtually any size—the data is sent back and forth with every page |
Query String | One user or one group of users | For the next request (can be reused across many requests) | Minimal, simple data |
Session | One user | As long as the user is active, plus a timeout period (typically 20 minutes) | Can be almost any size, but should be minimized since every user has their own separate session store |
Cache | All users or a subset of users | As long or as short as needed | Can be used for large or small, simple or complex data |
Context | One user | This request only | Can hold large objects, but typically does not since it is often used for every request |
View State | One user | One Web form | Minimal; as with Form Post, this data is sent back and forth with every page |
Config file | All users | Until the configuration file is updated | Can hold a lot of data; usually organized as many small strings or XML structures |