The loss of cookies and Chinese garbled

Source: Internet
Author: User
Tags file system iis firewall
cookie|cookies| Chinese | Chinese garbled

I developed the program under the file system, configured to IIS, cookies out of some problems.

The loss of 1,cookies
I was in the last few days of the essay "very difficult problem, using VS2005 in the file system mechanism developed under the Web program, configured to IIS can not run correctly?" "I've solved the problem of losing cookies to store Super Administrator privileges, but I didn't understand why, although the problem was finally resolved." Essay finally I gave a reason to be normal under the file system, not normal under IIS: The file system provides a micro-server every time it is debugged, allocating memory every time. In IIS, the first run is to allocate memory, as long as the program does not make changes, without recompiling, it will no longer reallocate memory. Today, I saw the use of Session FAQ in asp.net: It may be related to the environment of the machine, such as firewall or anti-virus software, try to shut down the firewall (the reason for losing the session should be the same as the reason for the loss of cookies). Think he said there is a reason, in the file system run should not go through the firewall, under IIS running will pass the firewall. It seems that I have not been the only one who has encountered this problem. I did not encounter any loss of cookies or sessions when I used asp.net1.1 before.

2,cookies's Chinese garbled
I suddenly discovered last night that the Chinese in the cookies under IIS appeared to be in trouble, displaying garbled characters.
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 VS2005 file System development project to notice.

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!



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.