Tech News

Difference between Viewstate and Sessionstate ?

 Session state is saved on the server, View State is saved in the page.
View State

1.View state is maintained in page level only .
2.View state information stored in client only.
3.View state persist the values of particular page in the client when post back operation done.  
4.Simple implementation View state does not require any custom
programming to use.
5.No server resources are required The view state is contained in a
structure within the page code.
6.If ViewState
grows larger, it affects the performance of garbage collection. 



Session State:
1.Session state is maintained in session level .
2.Sessioan state value is available in all pages within a user session.
3.Session stae information stored in server.
4.A session is defined as a period of time that is shared between the web
application and the user. Each user that is using the web application
has their own session. 
5.SessionState variables are cleared, when the user
session times out. The default is 20 minutes. This is configurable in
web.config
 Usage:
If you’re going to store information that you want to access on
different web pages, you can use SessionState If you want to store
information that you want to access from the same page, then you can use
Viewstate.   
Storage
The Viewstate is stored within the page itself (in encrypted text), while the Sessionstate is stored in the server.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x