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
var context = new HttpContextWrapper(HttpContext.Current);
HttpRequestBase request = context.Request;
var browserdetail = request.UserAgent;
This worked for me if you want only browser name then simply write:
var browserdetail = request.browser
And if you want clients ip address then simply do:
var browserdetail = request.hostaddress
and use it for
generating token key for authenticaton.