Type ' Insus.NET.PictureObject ' in Assembly ' App_Code, version=0.0.0.0, culture=neutral, Publickeytoken=null ' are not Marked as serializable.

Source: Internet
Author: User

Last night to implement a function, you need to store an object in the ViewState, but at run time, the following exception occurs.

Type ' Insus.NET.PictureObject ' in Assembly ' App_Code, version=0.0.0.0, culture=neutral, Publickeytoken=null ' are not Marked as serializable.

Description: An unhandled exception occurred during, the execution of the current Web request. Review the stack trace for more information about the error and where it is 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.

Workaround, add a property before this class:

[Serializable]


Such as:

Type ' Insus.NET.PictureObject ' in Assembly ' App_Code, version=0.0.0.0, culture=neutral, Publickeytoken=null ' are not Marked as serializable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.