1 var queryStrings = Request.Url == null
2 ? Request.QueryString
3 : HttpUtility.ParseQueryString(Request.Url.Query, Encoding.GetEncoding("GB2312"));
4
5 var value = queryStrings[key];
6
7 private string Decode(string value)
8 {
9 var utf8 = Encoding.UTF8;
10 var decode = HttpUtility.UrlDecode(value.ToUpper(), utf8);
11 var encode = (HttpUtility.UrlEncode(decode, utf8) ?? string.Empty).ToUpper();
12 var encoding = (value == encode) ? Encoding.UTF8 : Encoding.GetEncoding("GB2312");
13
14 return HttpUtility.UrlDecode(value, encoding);
15 }