在Request.ServerVariables,没有http_x_forwarded_for变量,只有remote_addr变量,但是这两个变量可以得到客户端的IP地址,因此它们之间的区别是什么
In ASP, we use Request.ServerVariables (REMOTE_ADDR) to get the IP address of the client, but if the client uses the proxy server to access, the IP address of the proxy server is taken instead of the real client IP address.To get the real IP address of the client through the proxy server, Request.ServerVariables (HTTP_X_FORWARDED_FOR) is used to read.
但值得注意的是,并不是每一个代理服务器可以阅读Request.ServerVariables客户端真实IP(http_x_forwarded_for )。有些代理服务器仍然读取代理服务器的IP。
还有一点要注意的是,如果客户不使用代理服务器,这是取request.servervariables价值(http_x_forwarded_for )将是空的。因此,如果你想在程序中使用这个方法,它可以处理这样的:
......
userip = request.servervariables(http_x_forwarded_for )
如果userip = 然后userip = request.servervariables(remote_addr )
......
那就是:如果客户端通过代理服务器的http_x_forwarded_for值取的remote_addr值如果代理服务器不通过了。

当然,上述方法并非万能,如第三段所述,您是否考虑过如果用户使用2级代理、3层代理、4代理…