标签:
public static bool IsMobile()
{
Regex RegexMobile = new Regex(@"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
if (HttpContext.Current.Request.Browser.IsMobileDevice)
{
return true;
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.UserAgent) && RegexMobile.IsMatch(HttpContext.Current.Request.UserAgent))
{
return true;
}
return false;
}
标签:
原文地址:http://www.cnblogs.com/zwei1121/p/5925459.html