日期:2014-05-16  浏览次数:20848 次

HttpContext.Current.Request.ServerVariables 乱码

string ua = HttpContext.Current.Request.ServerVariables["http_user_agent"];
 用uc浏览器部分机型ua带有中文会乱码,请问怎么解决?谢谢大家了!!
------解决方案--------------------
这个是asp.net负责解码的,应该解决不了,一般ua很少包含中文

一定更要获取含中文的ua,可以在跳转前将ua参数附加到url后面get发送到动态页,ua编码下,动态页通过参数来获取

<a href="xxx.ashx" onclick="this.href='xxx.ashx?ua='+encodeURIComponent(navigator.userAgent)">ua</a>



string ua=HttpContext.Current.Request.QueryString["ua"];