Web.Config文件中定义的网站编码是utf-8:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
从百度来网站的网址是"http://www.baidu.com/s?wd=%B3%C9%B9%A6%C1%CB”那么我们用Server.UrlDecode来接受就会出现乱码,在网上查了很久才找到解决办法:
Response.Write(HttpUtility.UrlDecode("http://www.baidu.com/s?wd=%B3%C9%B9%A6%C1%CB", Encoding.GetEncoding("gb2312")));
Response.Write(HttpUtility.UrlDecode("http://www.google.cn/search?hl=zh-CN&newwindow=1&q=%E6%88%90%E5%8A%9F%E4%BA%86&aq=f&oq=", Encoding.GetEncoding("utf-8")));
编码问题比较麻烦啊。