Kon*_*rad 7 asp.net asp.net-mvc mobile 51degrees
我想在ASP.net中检测移动设备是否是平板电脑(iPad)我看了51degrees项目但是检测平板电脑的功能在免费版本中没有 - 并且因为我们分发了我们的ASP.对100个客户的净解决方案,我们不能为所有客户购买51degrees许可证.
51degrees有免费或开源替代品吗?或者更新版本的MVC(4?)是否提供了比普通IsMobileDevice()更详细的信息?
谢谢,康拉德
Dan*_*ady 10
您可以请求用户代理并检查它是否包含"ipad"
bool isIpad = Request.UserAgent.ToLower().Contains("ipad");
Run Code Online (Sandbox Code Playgroud)
我们现在使用旧的移动设备浏览器文件: http://mdbf.codeplex.com/
并使用我们自己的浏览器文件对其进行扩展,如本解决方案中所述: http ://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx
现在我们甚至可以定义自己的参数来检测,例如,互联网浏览器的兼容性模式或将iPad定义为非移动设备。