检测通过什么平台打开网站

 1 string strUserAgent = Request.UserAgent.ToString().ToLower();
 2             if (strUserAgent != null)
 3             {
 4  
 5                 if (Request.Browser.IsMobileDevice == true || strUserAgent.Contains("iphone") ||
 6                 strUserAgent.Contains("blackberry") || strUserAgent.Contains("mobile") ||
 7                 strUserAgent.Contains("windows ce") || strUserAgent.Contains("opera mini") ||
 8                 strUserAgent.Contains("palm"))
 9                 {
10                     deviceType = "移动设备";
11                 }
12                 else
13                     deviceType = "PC设备";
14             }

 

posted @ 2016-04-07 10:13  黑色草莓  阅读(196)  评论(0编辑  收藏  举报