日期:2014-05-20  浏览次数:20397 次

问题困饶我一年了。!请高手帮忙!只有40分了。。。
1,首先写Cookie,   Response.Cookies[ "word "].Value   =   "我的电脑 ";
2,然后,   让页面中的一个   TextBox1.Text=Request[ "word "].ToString();
3,这时TextBox1在页面中显示的值就是“鎴戠殑鐢佃剳”   ;

我对   “鎴戠殑鐢佃剳”进行过编码转换   ,从所有的编码格式   转换到   gb2312   。
都没转成 "我的电脑 "。
我的页面Web.Config  
....
<globalization   requestEncoding= "gb2312 "   responseEncoding= "gb2312 "   />
....
我试过把他改成UTF-8   也不行。。。
请问怎么才能让页面正确显示 "我的电脑 "啊????
请高手帮忙啊!
冰天雪地裸体空翻720度脸着地跪求!

------解决方案--------------------
urlEncode之后再存
取后再urlDecode
------解决方案--------------------
Response.Cookies[ "word "].Value = Server.UrlEncode( "我的电脑 ");
this.Label1.Text = Server.UrlDecode(Request.Cookies[ "word "].Value);
测试取值正确!
------解决方案--------------------
Response.Cookies[ "word "].Value = Server.UrlEncode( "我的电脑 ");
this.Label1.Text = Server.UrlDecode(Request[ "word "].ToString());
也可以!测试正确!
------解决方案--------------------
Request[ "word "]这个集合包含了Get字符串、Form子控件、Cookies集合
虽然用Request[ "word "]取值不精确,但不是LZ问题的关键
还是那个观点,进行Url编码再存取