Normally this will be able to obtain the IP address of the client, but if the client is using a proxy server to access, that is the proxy server IP address, rather than the real client IP address, to get through the proxy server to obtain the real IP address of the client, Use Microsoft's Request.ServerVariables ("Http_x_forwarded_for") that is not published in the general ASP tutorials Technical documentation, but note that if the client is not accessed through a proxy server, the The value that Request.ServerVariables ("Http_x_forwarded_for") takes will be empty. Therefore, if you want to use this method in your program, you can handle this:
<title> Welcome to visit this website </title>
<body>
<% ip_address=request.servervariables ("Http_x_forwarded_for")
If ip_address= "" Then
ip_address= Request.ServerVariables ("REMOTE_ADDR")
</body>
That is: If the client through the proxy server, then take the value of http_x_forwarded_for, if not through the proxy server, take REMOTE_ADDR value.
Let's look at a real example
Function get_cli_ip () ' takes real IP function, http_client_ip and then Http_x_forwarded_for remote_addr
Dim client_ip br> if Checkip (Request.ServerVariables ("Http_client_ip")) =true then
Get_cli_ip = Checkip (request.servervariables ("Http_client_ip"))
Else
MyArray = Split (Request.ServerVariables ("Http_x_forwarded_for"), ",")
If UBound (myarray) >=0 Then br> client_ip = Trim (myarray (0))
if Checkip (client_ip) =true then
Get_cli_ip = client_ip
Exit Function
End If
End If
Get_cli_ip = Request.ServerVariables ("remote_addr")
End If
End Function