title: How to get IpAddress and UserAgent in ASP.NET Web API get methods
body: <p>I am using ASP.NET Web Api to expose a few GET methods.</p>
  
  <p>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 : </p>
  
  <ul>
  <li>Caller's Ip</li>
  <li>Caller's User Agent</li>
  <li>Caller's Used Url</li>
  </ul>
  
  <p>Now in the controller when I used to do this I used to use the following code,</p>
  
  <pre><code>var ipAddress = Request.ServerVariables["REMOTE_ADDR"];
  var userAgent = Request.UserAgent;
  </code></pre>
  
  <p>But here in Web API I am unable to use this.</p>
  
  <p>Can anyone please help me out with this.</p>