session vs. viewstate

Hi;

I have some huge data that I need to cache. (This question concerns asp.net 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
jazzIIIloveAsked:
Who is Participating?

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

x
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:
Hi

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:
Hi,

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?

Br
Kanti PrasadCommented:
Hi

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

http://www.aspdotnet-suresh.com/2012/11/aspnet-difference-between-viewstate-and.html

and some examples are in the below site

http://msdn.microsoft.com/en-us/library/bb386448(v=vs.100).aspx (view state)

http://msdn.microsoft.com/en-us/library/ms178581.aspx(session)
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:
CamilliaCommented:
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

Explanation

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.