title: Ip address of the client machine
body: <p>Please let me know how to get the client IP address,</p>
  
  <p>I have tried all of the below things , but I am getting the same output: 127.0.0.1</p>
  
  <pre><code>string strClientIP;
  strClientIP = Request.UserHostAddress.ToString();
  
  string strHostName = System.Net.Dns.GetHostName();
  string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
  
  string ipaddress = string.Empty ;
  ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
  if (ipaddress == "" || ipaddress == null)
      ipaddress = Request.ServerVariables["REMOTE_ADDR"];
  </code></pre>
  
  <p>How can I get the correct IP?</p>