How to solve the problem of cookie value loss and garbled code when the cookie value in Asp.net 2.0 is medium

Source: Internet
Author: User

When the total number of stored values in cookies is lost today, is there a limit on the number of stored values? Looking at the document, I did not find a similar saying. I divided it into two cookies for storage, but there were still problems. I finally realized the possible Chinese problem (I laughed at it). solution:

Storage:

Code
Cookie. Values. Add (truename,Httputility. urlencode(Truename ));
Cookie. Values. Add ("Nouser","");
Cookie. Expires=Datetime. maxvalue;
Cookie. Values. Add (username, username );
Cookie. Values. Add (password, password );

 

When reading:

 

Code
If(Mcookie! = Null)
{
A= Httputility. urldecode(Mcookie [truename]);
Builder. appendformat (string. Format ("Current Login User: {0}", ));
}

 

This solves the garbled problem.

When the value is lost, what is the use of the Chinese value and the value subsequently stored? The Connection becomes a value.

 

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.