Mobile Device Detection in asp.net
<p>The following is a Mobile device detection code which encompasses three different conditions     </p>

<pre><code>if (Request.Browser.IsMobileDevice)
{
   //Do Something
}
else if (((System.Web.Configuration.HttpCapabilitiesBase)myBrowserCaps).IsMobileDevice)
{
  //Do Something
}
else if (IsMobileDevice(mobileDevices))
{
  //Do Something
}

public bool IsMobileDevice()
{
     private static string[] mobileDevices = new string[] {"iphone","ppc"
                                                   "windows ce","blackberry",
                                                   "opera mini","mobile","palm"
                                                   "portable","opera mobi" };

         string userAgent = Request.UserAgent.ToString().ToLower();
         return mobileDevices.Any(x =&gt; userAgent.Contains(x));
 }
</code></pre>

<p>I was forced to write three conditions as they were failing for some devices,
Can anyone suggest a better approach?</p>
