I'm trying to get some of api users request information like the device that they use and the operating system so I tried it like this :
private string GetDeviceInfo()
{
var userAgent = HttpContext.Current.Request.UserAgent;
var uaParser = Parser.GetDefault();
var c = uaParser.Parse(userAgent);
return c.Device + "|" + c.OS + "|" + c.UserAgent;
}
but the HttpContext.Current.Request.UserAgent
is always null !. I searched about it and tried this link , could you please tell me what is wrong?