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;
}