.net前后台开发知识集

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

2017-07-19  本文已影响8人  飞天猪Pony
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;
}
上一篇 下一篇

猜你喜欢

热点阅读