Wednesday, August 13, 2008

Difference between View State and Session State

Difference between View State and Session State

Session state and view state are used to keep on certain data.

View State:

- View state is maintained in page level only.
- View state of one page is not visible in another page.
- View state information stored in client only.
- View state persist the values of particular page in the client (browser) when post back operation done.
- View state used to persist page-instance-specific data.

Session State:
- Session state is maintained in session level.
- Session state value is available in all pages within a user session.
- Session state information stored in server.
- Session state persist the data of particular user in the server. This data available till user close the browser or session time completes.
- Session state used to persist the user-specific data on the server side.

Difference between Session state and Application state

Difference between Session state and Application state
------------------------------------------------------
Session state and Application state both are support the same type of objects and maintain information on the server.

Session state:
- The session object is used to maintain the session of each user. A user gets a session id when he enters in to an application. This Id will delete when he leave from that application. If he enters again he will get a different session Id.
- Session allows information to be stored in one page and access in another page and support any type of object.

Application state:

- But the application object, the Id is maintained for whole application.
- Application state allows storing global objects that can be accessed by any client.