title: Cannot get user IP address (proxy/firewall/load balancer)
body: <p>I used code below to get client ip with asp.net before but after I moved to VDS this function begin returning only my subnet mask which is 178.18.198.1 or 178.18.198.2.
  Can anyone help me with this problem?</p>
  
  <pre><code>Private Function GetIPAddress() As String
      Dim sIPAddress As String = Nothing
      sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
  
      If String.IsNullOrEmpty(sIPAddress) Then
          sIPAddress = Request.ServerVariables("REMOTE_ADDR")
      End If
  
      Return sIPAddress
  End Function
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Found similar problem <a href="http://forums.iis.net/t/1175435.aspx">here</a>:</p>
  
  <blockquote>
    <p>Have deployed many 2008 32 bit
    standard web servers using the citrix
    netscaler isapi (the netscaler being a
    load balancer), in all cases the
    client IP address is logged in the
    standard IIS logs. On a new project I
    was asked to deploy 2008 R2,
    configured IIS 7.5 identically with
    how I configured IIS 7.0 in the past,
    this time however the client ip is
    returning the load balancer address in
    the logs. Here is the weird part, I
    installed "advanced logging" and it is
    showing the client IP address
    properly, so the isapi is doing its
    job. Have googled this one to death
    and could use some advice.</p>
  </blockquote>
  
  <p>I also found ISAPI Filter module but cannot make it work: <a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/08/19/x_forwarded_for_log_filter_for_windows_servers.aspx">devcentral.f5.com/x_forwarded_for_log_filter_for_windows_servers</a></p>