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 09:36
435 查看
昨晚想实现一个功能,需要把一个对象存储于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:
解决方法,在这个类前添加一个属性:
如:
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]
如:
相关文章推荐
- Objective-C 与 Runtime:为什么是这样?
- utils object doesn,t exists中毒后,就删除了.JS文件后台就出现了前面的英文。请问怎么解决
- iOS7之后JavaScript与Objective-C之间的通信
- Objective-C 【protocol-协议 的了解使用】
- Objective-C 【protocol-协议 的了解使用】
- NSManagedObjectContext 积累
- 条款13:以对象管理资源(use objects to manage resources)
- git cherry-check error "fatal: bad object"
- JavaScript之Object
- [Objective-C]getter和setter方法
- Objective-C类别(Category),分类
- python-selenium Page Object设计模式
- ios object-c errno
- javascript Object Pool 对象池
- JAVA Object 类简介
- Objective-C Runtime 运行时整理
- Objective C运行时(runtime)技术总结,好强大的runtime
- JSONObject 包的依赖
- Objective-C 内存管理2
- Objective-C 数组NSArray