0
        var webClient = new WebClient();

        var ipAddress = webClient.DownloadString("http://checkip.dyndns.org");
        ipAddress = (new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")).Match(ipAddress).Value;

// gives my site IP address

jps
  • 15,760
  • 14
  • 59
  • 71

1 Answers1

0

Use this:

this.HttpContext.Connection.RemoteIpAddress

It tells you about requester's host address and port number. Access this object inside your controller. It's usaually available in the form of HttpContext.Request.Host

Afshar Mohebi
  • 9,219
  • 13
  • 76
  • 122