Why can a ViewState contain only a serializable object?

I have a simple class with some properties and other data. Until I attach the serializable attribute to the class, I cannot save the class object in viewstate.

Why can a ViewState contain only serializable objects?

+5
source share
4 answers

When the request view is transferred back to the browser as a serialized view embedded in the generated HTML code of the page, it makes sense that only serializable objects can be placed in it (otherwise it may not display what it contains.) Then this viewstate is de-serialized during the next request.

http://i.msdn.microsoft.com/dynimg/IC152667.gif gives an example of the typical

POCO, serialisable, . , viewstate, .. :

http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx

.

+6

ViewState .

, Session. , .

+2

, , viewstate, ( ).

, , , , , .

+2

, : - Asp.Net HTTP, , , ( , asp.net), , .

enter image description here

+1

All Articles