http://msdn.microsoft.com/en-us/library/ms972976.aspx
http://msdn.microsoft.com/en-us/magazine/cc188774.aspx
These are the differences between Session & Viewstate in .Net web applictions:
1) Viewstate is particular to a control/page whereas session is for the whole application. You can access the session data stored in page A in page B but viewstate does not behave so.
2) ViewState is maintained at client side whereas session is maintained at server side
3) Since viewstate is maintained at client, it does not have a concept of expiry but session will expire after the stipulated time
4) You can enable/disable view state for specific controls but you can't do that for session.
5)Viewstate will be stored as encrypted value in the client page itself, where as session will not be stored anywhere other than memory.
6)Since session uses memory more and if you wants to load lot of data in session you will be adding extra load on server.
7)Eventhough viewstate values are encrypted still that can be hacked
8)We cant compare this two both has pro and cons so based on the scenario we have to use session or viewstate.
9) One more thing "Cache" is there which will also stores data but that is not page specific or user specific it is a general one of the head ache is we need to clean up the cache properly.
10)if we doesnt need the viewstate in a particular page we can disable that at page level so page will render very fast.
Thanks
Pavan Kumar
Mark Answer if this fits the need
Shanky11, if this helps please login to Mark As Answer. | Alert Moderator