×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ASP
Posted by: Loren Richter
Added: Feb 8, 2013 3:15 PM
Views: 28
Tags: mobile
  1.  
  2.         protected bool IsMobileDevice()
  3.         {
  4.             if (Request.UserAgent != null && Request.Browser != null)
  5.             {
  6.                 string userAgent = Request.UserAgent.ToLower();
  7.                 return Request.Browser.IsMobileDevice
  8.                  || (userAgent.Contains("android") && userAgent.Contains("mobile"))
  9.                  || (userAgent.Contains("blackberry") && userAgent.Contains("mobile"));
  10.             }
  11.             return false;
  12.         }
  13.