session vs. viewstate


I have some huge data that I need to cache. (This question concerns application)

Previously I used sessions but the session idea is not really working when the user logs into same browser and does the same stuff on 2 separate tabs.

So, I plan to switch to use viewstate but now i have a fear that the operation might be slower

Any insights?

Best regards.
LVL 12
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kanti PrasadCommented:

Viewstate                                           vs                                               Session
Is Current page life cycle                                    Persists across current session through out the application.
Transfers as encrypted                                        As it is server side it uses session identifier ( cookie or in the URL)

Hence as you are saying you have lot of data Veiwstate will be very slow due its encryption behaviour.
jazzIIIloveAuthor Commented:

Any offical Microsoft source for this?

How can i handle this? Apparently session is not suitable according to my scenario but then what should it be?

Kanti PrasadCommented:

When users are done with a particular block of data, set the Session variable to null as when Session expire memory will be reclaimed. Try to reduce the Session timeout but test it out to see users are cut off.

The below link will talk about more differences

and some examples are in the below site (view state)
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

David Johnson, CD, MVPOwnerCommented:
Previously I used sessions but the session idea is not really working when the user logs into same browser and does the same stuff on 2 separate tabs.

I worked on a project about 4 years ago and we found out that in IE (don't know about chrome), when user opens 2 tabs, session is shared between the tabs. This is a site that explains it


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jazzIIIloveAuthor Commented:
Yes, this link explains my problem. So session idea is not suitable..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.