.Net判断是否是安卓版的微信

protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
    var u = Request.UserAgent;
    if (IsAndroidWX(u))
    {   
        //如果是安卓版的微信就跳转到新的页面
        filterContext.HttpContext.Response.Redirect("http://www.baidu.com");
    }
}
[NonAction]
private bool IsAndroidWX(string u)
{
      if (u.IndexOf("Android") > -1 && u.IndexOf("MicroMessenger") > -1)
           return true;
      return false;
}

你可能感兴趣的:(.Net判断是否是安卓版的微信)