What is the difference between Viewstate and session state. Which one should I use?
1)Unlike Session state ViewState is a property of the web controls.
2)Values stored in the session are available across different pages in an
Where as the data contained in a control is persisted between page's post back by
using that controls ViewState property.
3)View state cannot be used if the page donot post back to itself and nformation is
stored in client only.
4)Moreover Viewstate are not secured as data is exposed to client. although we can
configure page directive and machine key to make view state encrypted. Where in case
of session this is user specific data that is stored in server memory . Session
state is valid for any type of objects.