State Management System in .Net

State

Currently available data is known as state.

There is 2 types of state management:

  1. Client side State Management
  2. Server side State Management

Client side State Management:

Client side State management use for maintain client side's state of Data.

  1. View State
  2. Hidden Field
  3. Cookies
  4. Query String

Server Side State Management:

  1. Session
  2. Cache
  3. Application

View State

Page State use for maintain the current status of page.

Hidden Field: Hidden field use for disable the field.

Cookies

Cookies is a small bit of text which contain the information about the site which has visited by User.

Syntax for Cookie:

HttpCookie Object =new HttpCookie();

Types of Cookie:

  1. In Memory Cookie
  2. Persistent Cookie

In these In Memory Cookie is by default cookie and Persistent Cookie is Permanent cookie.

The Default time for Cookie is 30 Minutes.

Session

Session is a server side state management ,Session is a time period for a Particular user.

In Asp .Net all web page developed is Http based ,and Http is state less,Cause of state less server is not able to recognize the page which has requested is new request or old request.

Syntax

session["Variable"]=value

Default time for session is 20 Minutes.

Query String

Query String use for maintain the state of data while Response page get to redirect.

Syntax

Response.Redirect("Target Page ?"Key=Variable);

Cache

Cache is server side state management which is a temporary memory, which use for improve the performance of the System.