网上找的,以备后用。

直接上代码:

public static string QueryStringDecode(string key)
{
HttpRequest Request = System.Web.HttpContext.Current.Request; if (Regex.IsMatch(
HttpUtility.UrlDecode(Request.Url.Query, Encoding.GetEncoding("iso-8859-1")),
@"^(?:[\x00-\x7f]|[\xfc-\xff][\x80-\xbf]{5}|[\xf8-\xfb][\x80-\xbf]{4}|[\xf0-\xf7][\x80-\xbf]{3}|[\xe0-\xef][\x80-\xbf]{2}|[\xc0-\xdf][\x80-\xbf])+$"
))
{
return Request.QueryString[key];
}
else
{
System.Collections.Specialized.NameValueCollection Rq = HttpUtility.ParseQueryString(Request.Url.Query, System.Text.Encoding.GetEncoding("gb2312"));
return Rq[key];
}
}

最新文章

  1. mysql测试题
  2. PHP DOS漏洞的新利用:CVE-2015-4024 Reviewed
  3. codeforces 505A. Mr. Kitayuta's Gift 解题报告
  4. 如何处理NBU Frozen Media
  5. android的消息处理有三个核心类:Looper,Handler和Message。
  6. swappiness
  7. iphone4s丢失如何找回
  8. ECSHOP 开发总结
  9. cmusphinx格式问题
  10. 搭建Eclipse开发和调试环境(真机)
  11. Python垃圾回收机制 总结
  12. 源码编译安装php7
  13. npm 如何查看一个包的版本信息?
  14. ubuntu系统安装微信小程序开发工具
  15. Docker+STF在ubuntu下测试环境搭建(详细搭建步骤及踩坑记录)
  16. 安装Git 创建版本库
  17. tomcat原理详解
  18. Android 开发 技术大纲
  19. Selenium自动化测试Python二:WebDriver基础
  20. Corel Video Studio Pro X5

热门文章

  1. Django初体验(一):自定义表单提交
  2. 在Solr中配置和使用ansj分词
  3. 【原】webapp开发中兼容Android4.0以下版本的css hack
  4. TopCoder SRM 642 Div.2 1000 --二分+BFS
  5. ural One-two, One-two 2
  6. 记录mysql的具体操作明细
  7. 一句话爆破速度提升一千倍python脚本
  8. 一个简单的socket程序运行与抓包查看
  9. sublime配置文件
  10. Utrack声卡和机架包的调试