About: "The session status cannot be serialized. In "StateServer" or "sqlserver" mode, ASP. NET serializes session State objects and therefore does not allow the use of non-serializable objects or externalbyref objects. If you customize

Source: Internet
Author: User

Error description:

Unable to serialize session status. In "StateServer" or "sqlserver" mode, ASP. NET serializes session State objects and therefore does not allow the use of non-serializable objects or externalbyref objects. If a custom session state is stored in custom mode and similar serialization is performed, the same restrictions apply.

Problem description:

I used the struct schema, Bill, and put multiple struct-type bills into an array variable of the arraylist type. I tried to assign the array value to the session and read the session on another page, system Error !!!

 

Solution:

After finding the problem online, I came to the conclusion that the variables I defined cannot be serialized, so I tried to add [serializable] to Bill. For example:

[Serializable]
Public struct Bill
{
Public string name;
Public String unit;
Public String count;
}

Solve the problem !!!

Related Article

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.