c# - Why Viewstate can contain only serializable object? -


i have simple class properties , other data. untill stick serializable attribute class, cannot save object of class viewstate.

why viewstate can contain serializable objects?

as viewstate of request passed browser serialised representation embedded within generated page's html makes sense serialisable objects can placed within (otherwise may fail represent contains.) viewstate de-serialised during next request.

http://i.msdn.microsoft.com/dynimg/ic152667.gif gives example of typical

if using poco's marking them serialisable should trivial enough. there excellent resource on understanding how viewstate works, etc. here:

http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/truly-understanding-viewstate.aspx

it goes full lifecycle of state , gives detail of it's implementation , use prospective of developer.


Comments