What is the difference between Session and ViewState? - ProProfs Discuss
Advertisement

What is the difference between Session and ViewState?

Asked by B. Wright, Last updated: Mar 30, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

S. Leo

S. Leo

I write blogs for my website. I an Ex employee for a Texas based MNC.

S. Leo
S. Leo, Content Blogger, Journalism and Content Marketing, Mexico

Answered Apr 21, 2020

Apart from session and ViewState, all other ASP.NET solutions usually include application variables, cookies, and caches. Both ViewState and session can run and can be accessible in a server environment. ViewState is usually used on the client-side while the session, on the other hand, is used on the server-side. ViewState doesn’t expire because they are on the client-side.

The session has expiration because it is on the server-side. ViewState only holds serializable data, while the session can actually hold a large type of data. This makes the amount of data in session much larger compared to ViewState.

The session can access data to a new page or a new window while ViewState is not capable of this. Session stores data in server memory, but ViewState stores its data in browser hidden fields as encrypted data. Since the server memory holds much different kinds of data, a large amount of stored data can affect server load.

upvote downvote
Reply 

H.Harper

H.Harper

H.Harper
H.Harper

Answered Apr 20, 2020

Season State will have details above a particular session that you may be searching for in a browser or a machine. This is one of the things that you can base on when you want to track what a client is doing whenever the person is on the website. There are also times when this can be used to monitor what the user is doing on multiple pages.

View State will have the details about a particular web page. This is placed somewhere hidden so that the user will not be able to view it. The only thing that it can show is the illusion that the website will remember the activity of the user the last time that he visited. This means that the user will be able to access the things that he is interested in.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.