How to Get Browser Agent from ASP.NET Web API Controller? | ASP.NET Web API Tutorial

The easiest way to get the full user-agent from inside an ASP.NET Web API-controller is as given below:
var userAgent = Request.Headers.UserAgent.ToString();
It gives exactly the same result as doing the manual step like this:
// var headers = request.Headers.GetValues("User-Agent");
// var userAgent = string.Join(" ", headers);