Click here to Skip to main content
15,899,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

What is the Diff between View state & Session state?

Can anyone give me a nice tutorial or URL link,in which I could get entire information about the whole session process both manual & automatic.and how session can get kiled and all ?

Thanks in advance

Naveen...
Posted
Updated 12-Feb-17 11:28am
v2

View state is a client side state mechanism.
Session state is a server side state mechanism.

See here.
 
Share this answer
 
Comments
nav234 5-Jul-10 11:29am    
thank you Abhinav .....
I would also recommend buying a book on ASP.NET development to cover these sort of basics.
 
Share this answer
 
from the code project Abhijit jana's article on session and View state are interesting.

checkout the following links

ViewState

Session[^]


regards
koolprasad2003 :)
 
Share this answer
 
Comments
Supriya Srivastav 25-Jan-12 3:08am    
My +5.
hiii


refer this for difference between Viewstate and Session:->

http://www.coolinterview.com/interview/9109/
http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=6591



Best to gain knowledge about Session State:->



http://msdn.microsoft.com/en-us/library/ms178581.aspx
 
Share this answer
 
Both ViewState and SessionState are ASP.NET state management techniques.

In case of ViewState, the page KeyValue collection will be serialized and converted to Base64 and written on your page. So you can see the data if you go View ->Source.

Session stays in the server memory. It determines your session data based on the Session Id. When Session timeouts the server clears all the data associated with your session.
:rose:
 
Share this answer
 
Check this link, this will help you to understand more about State Management in ASP.Net.
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx[^]
 
Share this answer
 
It's right here in the beginner section of ASP.Net for View State and Session State. It's a nice beginner level tutorial, which i find it great in understanding.

View State: http://www.codeproject.com/KB/aspnet/BegViewState.aspx

Session State: href="http://www.codeproject.com/KB/aspnet/ExploringSession.aspx

Hope this helps !!

-Ron.
 
Share this answer
 
v2
SQL
ViewState is used to store data that can be used on postback to the same page whereas Session is also used to store data but the data stored in Session can be used anywhere in the webapplication. Only serializable objects can be stored in ViewState. ViewState information is rendered on the page in encrypted form when the page is rendered on browser whereas session data is stored on server.
 
Share this answer
 
Both are meant for mentaining or storing the values.
Scope of ViewState is only to page.
Scope of Session is across a user.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900