Introduction

State Management is the process by which the state and information of a page can be maintained over multiple requests.

ASP.NET provides several techniques to maintain the information. The choice depends on the scope of the data and performance considerations. One or more techniques can be used a single application depending on the needs

State management

Various methods are used for State Management. They are

  1. View State
  2. Cookies
  3. Query String
  4. Session State
  5. Application State

All the preceding methods are used for State Management. View State, Cookies, and Query String are methods of Client-Side State Management whereas Session State and Application State are methods of Server-Side State Management.

ASP.NET state management can be broadly divided into the following following two categories

  1. Client-Side State Management
  2. Server-Side State Management

Client-side state management

In Client-Side State Management, the state of the page is maintained on the client side. The following are the various techniques for Client-Side State Management.

In Client-Side State Management, data is stored on the client side and sent to the browser every time. This increases bandwidth usage. If the size of data is greater then the application will be less responsive. Performance issues would occur.

View state

Laminations of view state

Cookies

A cookie is another Client-Side State Management technique to store data and access it on another page. It is actually a small file stored in the client's RAM or on the hard disk. Cookies can be either temporary or permanent.

Laminations of cookies

Query string

Laminations of the query string

Server-side state management

In the Server-Side State Management, the state of the page is maintained at the server side. The following are the various techniques for Server-Side State Management.

Server-side state Management provides better security. The state is saved on the server and isn't delivered to the client. The server side reduces the traffic to and from the client because the data is not sent to the browser.

Application state (variable)

Session state (variable)