title: How to indentify http request coming from mobile device in ASP.NET C#?
body: <p>Does anyone know how to identify request coming from mobile device in asp.net? I am using this code but using mini opera emulator to check whether its coming from mobile or desktop application.</p>
  
  <pre><code>HttpRequest httpRequest = HttpContext.Current.Request;
  
  if ((httpRequest.Browser.IsMobileDevice))
  {
     string path = httpRequest.Url.PathAndQuery;
     bool isOnMobilePage = path.StartsWith("/Mobile/", StringComparison.OrdinalIgnoreCase);
  
     if (!isOnMobilePage)
     {
        string redirectTo = "~/Mobile/";
        HttpContext.Current.Response.Redirect(redirectTo);
     }
  }
  </code></pre>
  
  <p>I am using Visual Studio and it does not have built in mobile sdk.</p>
  
  <p>Thanks</p>