Why Viewstate can contain only serializable object?

后端 未结 4 576
野的像风
野的像风 2020-12-19 13:28

I have a simple class with some properties and other data. Untill i stick serializable attribute to the class, i cannot save the object of the class into the viewstate.

4条回答
  •  有刺的猬
    2020-12-19 14:11

    Because the ViewState is serialized before it is sent to the Client.

    Maybe you can store your data in the Session object instead. It depends on what your class does and how it's used.

提交回复
热议问题