-1

I'm using microsoft's APIController in a web api, I'd like to see information about the requestor, such as the IP and whatever other info about requestor I can find out. IE

public class ExampleController : ApiController
{
    [HttpGet]
    [HttpPost]
    public HttpResponseMessage GetStuff(HttpRequestMessage message)
    {
        //get info about caller, maybe using
        //HttpContext.Current.Request. something
        var requestorIP = ????
    }

} 
ldyaxqcy
  • 29
  • 4

1 Answers1

-2

It looks like you can get the remote IP address through Context.Connection.RemoteIpAddress, the remote port is also on the connection object.

IllusiveBrian
  • 3,105
  • 2
  • 14
  • 17