How to retrieve the TRUE IP address in ASP

This is an article on How to retrieve the TRUE IP address in ASP in ASP.

Rated 5.00 By 1 users

Request.ServerVariables("REMOTE_ADDR") can be used to retrieve the IP address of the client machine.

While clients connect internet via a proxy server, the above method only return the IP address of the proxy server, other than the REAL IP address of the client machine. In order to request the TRUE IP address of the client via the proxy server, you may use
Request.ServerVariables("HTTP_X_FORWARDED_FOR").

One more thing, if the client does not connect the internet via a proxy server, then Request.ServerVariables ("HTTP_X_FORWARDED_FOR") will return a null value. Therefore, you can use this method in your program like this:

Thats a good point. If it is going to retreive the original IP, why do people use all these proxy sites to hide their traces? So, if we are going to use the SERVER VARIABLE specified by you, we will be knowing there true IPs, isin't it? Or is there a different way these proxy sites work?

This tutorial covers on fetching the exact client IP address. Here the author explains that using Request.ServerVariables("REMOTE_ADDR") can only bring the IP address of the proxy server. So the author finally decided to use...