ASP.NET

STATE MANAGEMENT IN ASP.NET

State management means to preserve state control and object in an application explicitly because all ASP.NET web applications are stateless. There are two types of State Management techniques. They are Client-side and Server-side.

Client-side state management

Client-side state management maintains information on the client’s machine using Cookies, View State, Query Strings and Hidden fields.

Cookies

A cookie is a small amount of data, which is stored in a text file or in memory of the client browser session. It is not good for sensitive data. Cookies are always sent along with the request to the webserver.

View State

The View State provides page-level state management. That is, as long as the user is on the current page, the state is available when the user redirects to the next page and the current page state are lost. The view State can store any type of data because it is object type, but it is not preferable to store a complex type of data due to the need for serialization and deserialization on each postback.

Querystring

Query strings are used for holding some values from a different page and move these values to another page. The information stored in the Query string can be easily navigated to another page or to the same page as well.

Hidden Fields

Hidden fields in HTML simply input fields and not visible on the browser during execution. These are used to store data at the page level.

Server-side state management

Application State

The data stored in an application object can be shared by all the sessions of the application. The application object stores data in the key-value pair

Session State

The Session state is generally used for storing application data such as inventory, supplier list, customer record, or shopping cart. It can also keep information about the user and his preferences, and keep the track of pending operations.

Author: STEPS

Leave a Reply

Your email address will not be published. Required fields are marked *