I am using ASP.NET Web Api to expose a few GET methods.
But before I return the data I need to log a couple of details to the db, of which few of them are as listed below :
- Caller's Ip
- Caller's User Agent
- Caller's Used Url
Now in the controller when I used to do this I used to use the following code,
var ipAddress = Request.ServerVariables["REMOTE_ADDR"];
var userAgent = Request.UserAgent;
But here in Web API I am unable to use this.
Can anyone please help me out with this.