What is the difference between viewstate and sessionstate?

What is the difference between viewstate and sessionstate?
anirban09p's Avatar
ViewState persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.

SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.
alia123's Avatar, Join Date: Jan 2016
ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application.
Session State contains information that is pertaining to a specific session with the server. It's a way to track what the user is doing on the site across multiple pages Cookies can be used for session state.
View State on the other hand is information specific to particular web page. It is stored in a hidden field so that it isn't visible to the user. It is used to maintain the user's illusion that the page remembers what he did on it the last time but don’t give the exact page.