On my phone, using LTE (not wifi), if I go to whatismyipaddress.com, it reports the IP address as 166.216.xxx.xxx. But if I go to whatismyip.com, it is reported as 107.77.xxxx.xxx. Why is that?
When I connect to my server with my phone (again LTE, not wifi), the server-side ASP.Net code attempts to retrieve the IP address via Request.UserHostAddress, and it is always 166.216.xxx.xxx. But how can I retrieve the 107.77.xxxx.xxx address instead? I've tried using Request.ServerVariables["HTTP_CLIENT_IP"] and Request.ServerVariables["HTTP_X_FORWARDED_FOR"] to no avail (both return null), and Request.ServerVariables["REMOTE_ADDR"] returns the same 166.216.xxx.xxx value as Request.UserHostAddress.
I've tried to limit the scope of my problem to the questions above, so if you can answer those sufficiently, I should (hopefully) be able to solve my issue. But in case you're wondering why this is a problem for me, read on.
I'm developing a phonegap application and on my production server (hosted in Azure) Request.UserHostAddress returns the 166.216.xxx.xxx IP address when I connect to it via the mobile browser (Safari) BUT returns the 107.77.xxxx.xxx IP address when I connect to it via my phonegap app.
I'm attempting to do so some very short-term, time-sensitive, identification of the connecting user's device when they access my server via the mobile browser (Safari), and then subsequently access it via the installed phonegap app, and the IP address figures into the algorithm, but because it's reported differently from the mobile browser vs the app it doesn't work properly.
At first I thought it was something to do with the how the phonegap app's network connectivity works (and it still might be) but because I'm able to get two different IP addresses reported from whatismyipaddress.com and whatismyip.com when accessing those sites via the mobile browser (Safari), I figure it has more to do with the technique used to retrieve the client IP address.
Any help would be greatly appreciated, Thanks.