博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
是否手机访问
阅读量:5139 次
发布时间:2019-06-13

本文共 1699 字,大约阅读时间需要 5 分钟。

public static Boolean IsMobileDevice()

{
string[] mobileAgents = { "iphone", "android", "phone", "mobile", "wap", "netfront", "java", "opera mobi", "opera mini", "ucweb", "windows ce", "symbian", "series", "webos", "sony", "blackberry", "dopod", "nokia", "samsung", "palmsource", "xda", "pieplus", "meizu", "midp", "cldc", "motorola", "foma", "docomo", "up.browser", "up.link", "blazer", "helio", "hosin", "huawei", "novarra", "coolpad", "webos", "techfaith", "palmsource", "alcatel", "amoi", "ktouch", "nexian", "ericsson", "philips", "sagem", "wellcom", "bunjalloo", "maui", "smartphone", "iemobile", "spice", "bird", "zte-", "longcos", "pantech", "gionee", "portalmmm", "jig browser", "hiptop", "benq", "haier", "^lct", "320x320", "240x320", "176x220", "w3c ", "acs-", "alav", "alca", "amoi", "audi", "avan", "benq", "bird", "blac", "blaz", "brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "hipt", "inno", "ipaq", "java", "jigs", "kddi", "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-", "moto", "mwbp", "nec-", "newt", "noki", "oper", "palm", "pana", "pant", "phil", "play", "port", "prox", "qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal", "smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tosh", "tsm-", "upg1", "upsi", "vk-v", "voda", "wap-", "wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-", "Googlebot-Mobile" };
var request = HttpContext.Current.Request;
return mobileAgents.Any(t => request.UserAgent != null && request.UserAgent.ToString().ToLower().IndexOf(t, StringComparison.Ordinal) >= 0);
}

转载于:https://www.cnblogs.com/cunfu/p/6544045.html

你可能感兴趣的文章
[转载] Mac下使用iTerm2让SSH免密码登录远程服务器
查看>>
配置全局的导航栏样式(微信开发)
查看>>
python爬虫Day2:selenium基本使用
查看>>
Tomcat几种出错方法
查看>>
常用的adb命令
查看>>
Mycat 配置文件schema.xml
查看>>
【排序】绝境求生
查看>>
观察者模式(Observer Pattern)
查看>>
[深度学习]开源的深度学习框架
查看>>
算法图解笔记
查看>>
HashMap源码解析
查看>>
DVWA笔记之三:CSRF
查看>>
Dockerfile分享之SSH Server
查看>>
Linq to SQlite的使用
查看>>
HDU 1069 [Monkey and Banana] 动态规划
查看>>
使用Redshift渲染器,怎么选电脑配置!
查看>>
vue-element:文件上传七牛之key和异步的问题
查看>>
【BZOJ2631】tree (LCT)
查看>>
python常用代码笔记
查看>>
机器学习之路:python 集成分类器 随机森林分类RandomForestClassifier 梯度提升决策树分类GradientBoostingClassifier 预测泰坦尼克号幸存者...
查看>>