2

i want to know what is the difference between viewstate and sessions. thank you

Surya sasidhar
  • 29,607
  • 57
  • 139
  • 219
  • Related question http://stackoverflow.com/questions/2683467/what-is-the-difference-between-postback-data-and-view-state-data – Roman May 06 '10 at 13:25

2 Answers2

4

Viewstate persists state across postbacks and can therefore hold the state of controls on the page etc.

Session persists data across the whole session of the user and can therefore hold data that needs to be stored for longer time (such as a shopping basket)

kimtiede
  • 202
  • 1
  • 8
0

ViewState gets embedded in the form and sent to the browser, then gets submitted as part of form back to the server. Session resides on the server the whole time.

Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172