Does viewstate expire? Does viewstate expire? asp.net asp.net

Does viewstate expire?


Viewstate itself does not expire. Since it's posted back in a form, it can be reconstituted any time.

According to MSDN: "...it is possible for view state to expire if a page is not posted back within the session expiration time". So, in a round about sort of way, it can expire if your session does, but viewstate does not directly expire. Since you're not using session state anyway, you don't have to worry about implicit expiration.

Note that I wouldn't have said it expired. That was MS who I quoted in their own article entitled Controlling ViewState


No ViewState is kept as part of the PostBack process. You can, however, override the Page class's SavePageStateToPersistenceMedium() and LoadPageStateFromPersistenceMedium(), to implement that behavior if desired. For more information read Understanding the ASP.NET ViewState.

Note that Page ViewState is stored in the Session so if your Session expires, the ViewState will be lost. I wouldn't say this is ViewState expiring, but yes, it will be destroyed after Session timeout.


Viewstate does not expire.

All viewstate data is stored on the client and is submitted back to the server when the user executes a postback.

This has some very interesting implications, and is explained very thoroughly here.