Cannot get user IP address (proxy/firewall/load balancer)

前端 未结 2 1781
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 17:00

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

相关标签:
2条回答
  • 2021-01-05 17:33

    I use

    IP.Text = Request.UserHostAddress;
    

    In C#. Does that work for you?

    0 讨论(0)
  • 2021-01-05 17:35

    Problem solved by using HTTP_CLIENT_IP instead of REMOTE_ADDR in sourcecode files.

    The problem about IIS Logs was solved by installing IIS Advanced Logging module as suggested here. Also I got error "503: Service Unavailable" after installing Advanced Logging but solved this by granting read-write permissions to Everyone for Program Files\IIS folder and started failed application pools.

    http://kb.parallels.com/6735

    Another solution suggested here is:

    On the NetScaler under "load balancing", "Services" then under the advanced tab, under settings, check the box for "Use Source IP" and "Client IP" then in the Header field "CLIENT-IP"

    0 讨论(0)
提交回复
热议问题