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
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
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