Asp.net reads the cookie with the plus sign (+) and automatically replaces the plus sign with a space.

Source: Internet
Author: User

During cookie verification today, I found that none of the verification methods were correct. The strange thing is that the previous verification was normal. This time, I only changed the value, after debugging, it is found that the value of a cookie in the browser is "lv502zeal75 + 9l5gjqhhdg =", but inProgram"Lv502zeal75 9l5gjqhhdg =" is read in. the plus sign in the original Cookie has been replaced with a space. Google searched for it and found that there is a help document on MS online, "ASP may improperly parse cookies containing a plus sign", but it is about ASP and iis4.0.

My Cookie is encrypted with DES because the plus sign does not appear in the previous value encryption number, and the plus sign appears when another value is changed later, resulting in verification failure.

Solution:

Encode the space with string. Replace ("+", "% 2B ")

During cookie verification today, I found that none of the verification methods were correct. The strange thing is that the previous verification was normal. This time, I only changed the value, after debugging, we found that the cookie value in the browser is "lv502zeal75 + 9l5gjqhhdg =", but what we read in the program is "lv502zeal75 9l5gjqhhdg = ", in the past, the plus sign in the cookie has been replaced by a space. Google searched and found that Ms has compiled this help document on the Internet, "ASP may improperly parse cookies containing a plus sign ", however, ASP and iis4.0.

My Cookie is encrypted with DES because the plus sign does not appear in the previous value encryption number, and the plus sign appears when another value is changed later, resulting in verification failure.

Solution:

Encode the space with string. Replace ("+", "% 2B ")

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.