Thanks, what type of collections does each of these use? And would you mind providing an example of when it's more beneficial to you a "Viewstate" over a "Session"?
In your case you need to use Session because you want it to span multiple pages. You just set Session("key1") = whatever value or object; then you read it back via Session("key1") casting it back to the data type stored. Simple.
akrmoyk
Member
16 Points
14 Posts
What are the differences and similarities between "Viewstate" and "Session" in ASP.Net?
Mar 12, 2012 06:28 PM|LINK
I need to store information across multiple pages and I was wondering what the difference is between "Viewstate" and "Session" in ASP.Net?
When is it preferable to use one or the other, and what are their similarities?
Also, what type of collection are each of these?
Andy Tauber
Member
94 Points
17 Posts
Re: What are the differences and similarities between "Viewstate" and "Session" in ASP.Net?
Mar 12, 2012 06:30 PM|LINK
Session applies to just that the entire session. Viewstate is stored on the screen or control as encrypted data.
MCDBA, MCSE
www.andytauber.com
andy (@) andytauber.com
Please "Mark As Answer" if my reply was helpful.
akrmoyk
Member
16 Points
14 Posts
Re: What are the differences and similarities between "Viewstate" and "Session" in ASP.Net?
Mar 12, 2012 06:34 PM|LINK
Thanks, what type of collections does each of these use? And would you mind providing an example of when it's more beneficial to you a "Viewstate" over a "Session"?
MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: What are the differences and similarities between "Viewstate" and "Session" in ASP.Net?
Mar 12, 2012 06:37 PM|LINK