title: Asp.Net 5 MVC 6 detect mobile browser
body: <p>How is it possible in <strong>Asp.Net 5 MVC 6</strong> to detect if the user is on a mobile device?</p>
  
  <p>In previous version of <code>Asp MVC</code> it could be done like this:</p>
  
  <pre><code>Request.Browser.IsMobileDevice
  </code></pre>
  
  <p>The problem is that the namespace <code>System.Web</code> is not used by <code>Asp.Net 5</code>. </p>
  
  <p>The <code>Request</code> variable in the controller actions is now of type <code>Microsoft.AspNet.Http.HttpRequest</code>, the old version was of type <a href="https://msdn.microsoft.com/en-us/library/system.web.httprequestbase%28v=vs.110%29.aspx"><code>System.Web.HttpRequestBase</code></a>. </p>
  
  <p><code>Microsoft.AspNet.Http.HttpRequest</code> does not contain the <code>Browser</code> property. I tried looking through other properties, but didn't find anything. </p>
  
  <p><strong>EDIT:</strong> as requested some resources that prove that <code>Asp.Net 5</code> does not use <code>System.Web</code> anymore.
  From the <a href="http://docs.asp.net/en/latest/conceptual-overview/aspnet.html">Asp.Net documentation</a></p>
  
  <blockquote>
    <p>ASP.NET 5 is no longer based on System.Web.dll, but is instead based
    on a set of granular and well factored NuGet packages allowing you to
    optimize your app to have just what you need.</p>
  </blockquote>