Client-side state management & Server-side state management

Client Side State Management

Cookies : You need to store small amounts of information on the client and security is not an issue.
View state : You need to store small amounts of information for a page that will post back to itself. Use of the ViewState property does supply semi-secure functionality.
Hidden fields : You need to store small amounts of information for a page that will post back to itself or another page, and security is not an issue.
Note : You can use a hidden field only on pages that are submitted to the server.
Query string : You are transferring small amounts of information from one page to another and security is not an issue.
Note : You can use query strings only if you are requesting the same page, or another page via a link.

Server-side state management

Application state object : You are storing infrequently changed, application-scope information that is used by many users, and security is not an issue. Do not store large quantities of information in an application state object.
Session state object : You are storing short-lived information that is specific to an individual session, and security is an issue. Do not store large quantities of information in a session state object. Be aware that a session state object will be created and maintained for the lifetime of every session in your application. In applications hosting many users, this can occupy significant server resources and affect scalability.
Database support : You are storing large amounts of information, managing transactions, or the information must survive application and session restarts. Data mining is a concern, and security is an issue.


Session State or ViewState?

There are certain cases where holding a state value in ViewState is not the best option. The most commonly used alternative is Session state, which is generally better suited for:
Large amounts of data.As ViewState increases the size of both the HTML page sent to the browser and the size of form posted back, it's a poor choice for storing large amounts of data.
Sensitive data that is not already displayed in the UI.While the ViewState data is encoded and may optionally be encrypted, your data is most secure if it is never sent to the client. So, Session state is a more secure option.
Objects not readily serialized into ViewState, for example, DataSet.As already discussed the ViewState serializer is optimized for a small set of common object types. Other types that are serializable may be persisted in ViewState, but are slower and can generate a very large ViewState.

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites