码迷,mamicode.com
首页 > 移动开发 > 详细

Type 'Insus.NET.PictureObject' in Assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

时间:2015-09-07 10:47:29      阅读:364      评论:0      收藏:0      [点我收藏+]

标签:

 昨晚想实现一个功能,需要把一个对象存储于ViewState中去,但在运行时,出现下面的异常。

技术分享

Type ‘Insus.NET.PictureObject‘ in Assembly ‘App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null‘ is not marked as serializable.        

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            
Exception Details: System.Runtime.Serialization.SerializationException: Type ‘Insus.NET.PictureObject‘ in Assembly ‘App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null‘ is not marked as serializable.
Source Error:

 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

解决方法,在这个类前添加一个属性:

 [Serializable]


如:
技术分享

 

Type 'Insus.NET.PictureObject' in Assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

标签:

原文地址:http://www.cnblogs.com/insus/p/4786586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!