Use request. servervariables ("remote_addr") to obtain the IP address of the client. However, if the client is accessed by a proxy server, the IP address of the proxy server is obtained instead of the real IP address of the client. To obtain the real IP address of the client through the proxy server, use request. servervariables ("http_x_forwarded_for") to read.
However, not every proxy server can use request. servervariables ("http_x_forwarded_for") to read the real IP address of the client, some of which are still the IP address of the proxy server.
Note that if the client is not accessed through the proxy server, the value obtained using request. servervariables ("http_x_forwarded_for") will be null. Therefore, if you wantProgramYou can use this method as follows:
......
Userip = request. servervariables ("http_x_forwarded_for ")
If userip = "" Then userip = request. servervariables ("remote_addr ")
......
That is, if the client uses the proxy server, the value of http_x_forwarded_for is obtained. If the client does not pass the proxy server, the value of remote_addr is obtained.