asp.net cookies lost and Chinese garbled _ practical skills
Source: Internet
Author: User
I was in the photo album last night when suddenly found that the IIS under the Chinese in the cookies and there are problems, display garbled.
It took a while to solve:
When writing cookies
String T =httputility.urlencode (to be written to the Chinese value of the cookie);
HttpCookie C = new HttpCookie ("User_realname", t);
RESPONSE.COOKIES.ADD (c);
When reading cookies
T= the value of the Chinese cookies obtained;
t = Httputility.urldecode (teacher_name);
That's the solution.
Remind friends who are using the VS system development project to pay attention.
The reason why the file system and IIS run a difference should be related to their operating mechanism, hoping to find some information about their operating mechanism to see!
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