WHAT IS THE DIFFERENCE BETWEEN SESSIONSTATE AND VIEWSTATE IN ASP.NET?

Vijay Shukla

Total Post:81

Points:405
Posted by  Vijay Shukla
 1918  View(s)
Ratings:
Rate this:
  1. Vijay Shukla

    Post:81

    Points:405
    What is the difference between SessionState and ViewState in ASP.NET?

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!