title: The difference among four ways to get the client ip address
body: <p>Q:</p>
  
  <p>I need to know the difference among the following:</p>
  
  <pre><code>Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ;
  
  
  Request.ServerVariables["REMOTE_ADDR"];
  
  System.Web.HttpContext.Current.Request.UserHostAddress;
  
  System.Net.IPAddress[] strClientIPAddress = System.Net.Dns.GetHostAddresses(Environment.MachineName);
  </code></pre>
  
  <p>I want to get the client <code>IP</code> address (the user who access the site)and I'm confused among the previous methods which one more accurate.</p>