The cookie directly written by ASP cannot be directly read by Asp.net. To rewrite it, ASP CodeAs follows:
Response. Cookies ("adminname") = RS ("username ")
Response. Write Request. Cookies ("adminname ")
The second line seems to be somewhat redundant, and the code is somewhat strange. However, in this case, Asp.net can indeed read it correctly. The code in Asp.net is as follows:
Adminname = request. Cookies ["adminname"]. value. tostring ();
Since the value I uploaded may be Chinese, I tried Chinese. As a result, Asp.net reads yes.
% D5 % Fe % D6 % Ce % B4 % A6
This is also very simple, just turn it around, and the result can't be converted with server. urldecode, think of the previous section of Baidu thievesProgramA code conversion method is as follows:
System. Web. httputility. urldecode (adminname, system. Text. encoding. getencoding (936 ));
In this way, you can obtain normal Chinese characters;
I will sort out the above ideas;
To write a cookie in ASP, follow these steps:
Response. Cookies ("Cookie name") = "cookie value"
Response. Write Request. Cookies ("Cookie name ")
When reading data in Asp.net, including reading Chinese:
String cookie;
Cookie = request. Cookies ["Cookie name"]. value. tostring ();
Cookie = system. Web. httputility. urldecode (cookie, system. Text. encoding. getencoding (936 ));
I only write ASP to write cookies here. The Asp.net reading method does not write Asp.net to write cookies and can be read using ASP. I have the opportunity to study it again.