HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
To get the IP address of the machine, not the proxy, use the following code
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
source
share