Type 'insus. NET. pictureobject' in assemb' App _ Code, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null' is not marked as serializable., publickeytoken
To implement a function last night, you need to store an object in ViewState, but the following exception occurs during runtime.
Type 'insus. NET. pictureobject' in assemb' 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 assemb' 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. |
Solution: add an Attribute before the class:
[Serializable]
For example: