Use Request.ServerVariables(REMOTE_ADDR) in ASP to obtain the client's IP address. However, if the client uses a proxy server to access, what is obtained is the IP address of the proxy server, not the real client IP address. To obtain the client's real IP address through the proxy server, use Request.ServerVariables(HTTP_X_FORWARDED_FOR) to read it.
However, it should be noted that not every proxy server can use Request.ServerVariables(HTTP_X_FORWARDED_FOR) to read the real IP of the client. Some of the IPs read by this method are still the IP of the proxy server.
Another thing to note is that if the client does not access through a proxy server, the value obtained with Request.ServerVariables(HTTP_X_FORWARDED_FOR) will be empty. So, if you want to use this method in your program, you can do it like this:
...
userip = Request.ServerVariables(HTTP_X_FORWARDED_FOR)
If userip = Then userip = Request.ServerVariables(REMOTE_ADDR)
...
That is: if the client passes the proxy server, the value of HTTP_X_FORWARDED_FOR is taken. If the client does not pass the proxy server, the value of REMOTE_ADDR is taken.