State
Currently available data is known as state.
There is 2 types of state management:
- Client side State Management
- Server side State Management
Client side State Management:
Client side State management use for maintain client side's state of Data.
- View State
- Hidden Field
- Cookies
- Query String
Server Side State Management:
- Session
- Cache
- 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:
- In Memory Cookie
- 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.