Home > DeveloperSection > Interviews > What is the difference between SessionState and ViewState in ASP.NET?

Posted on    December-15-2012 4:30 AM

 ASP.Net ASP.Net 
Ratings:
 1 Answer(s)
  1679  View(s)
Rate this:

Vijay Shukla

Total Post:81

Points:405
Posted on    December-15-2012 1:00 AM

SessionState

  • Can be persisted in memory, which makes it a fast solution. Which means state cannot be shared in the Web Farm/Web Garden.
  • Can be persisted in a Database, useful for Web Farms / Web Gardens.
  • Is Cleared when the session dies - usually after 20min of inactivity.

ViewState

  • Is sent back and forth between the server and client, taking up bandwidth.
  • Has no expiration date.
  • Is useful in a Web Farm / Web Garden

Don't want to miss updates? Please click the below button!

Follow MindStick