开发者

What does "DataView is not marked as serializable in System.data" mean?

开发者 https://www.devze.com 2023-03-25 04:25 出处:网络
When I store dataview in viewstate,.net shows the error \"Dataview is not marked as serializable in system.data but when I store it in session, then it works perfectly?

When I store dataview in viewstate,.net shows the error "Dataview is not marked as serializable in system.data but when I store it in session, then it works perfectly? What is the reason behind i开发者_运维百科t?? Which are the other objects that are not marked as "serializable " ?


It means that the object you want to store (DataView) isn't marked with a SerializableAttribute.

Now, the reason you're getting this error with ViewState and not with Session is because the ViewState is always serialized but that's not necessarily true of Session. In-Process sessions are stored in the server's memory and require no serialization. SQLServer sessions have to be serialized for storage in a database.

So, anytime you want to store an object in the ViewState (or a serialized Session), it must be marked with a SerializableAttribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消