I\'m trying to get the user-agent in a web api self host and I\'m either doing it wrong, or the web api itself is altering the user agent string.
I\'ve tried using sever
The answer is simple try the following. It's shorter and less likely to break.
String userAgent;
userAgent = Request.UserAgent;
It will give you a string similar to this one.
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
Documentation: http://msdn.microsoft.com/en-us/library/system.web.httprequest.useragent.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2