0

The long and the short of this is that we use a 3rd party to retrieve addresses from the PAF database (and similar for non-UK addresses). They need the client IP address to deduce what sort of addresses (ie: British/Irish/Canadian/Amoeboid-Zingat'ularian) to default the search to. We pass this traffic through a relay written as an MVC controller [HttpPost] action, and inject the authentication on the server, for security reasons.

For our customers that have our software hosted on Azure, this is easy, as the traffic between MVC controller action and the 3rd party's javascript will pass through an internet-facing firewall, and the IP gained using Request.ServerVariables["REMOTE_USER"] will be good enough. BUT what if they have our software installed on premise? Then, isnt it possible that the IP this method gives me is one that only means anything to the local network?

If I could detect the difference, I could decide whether or not to send the IP: and therefore get the 3rd party to decide.

JimFR
  • 89
  • 11
  • Not sure if I'd call this a dupe or not, but [see here](https://stackoverflow.com/questions/3253701/get-public-external-ip-address). You need to get the client's external IP address. – Jon B Jul 19 '17 at 13:52
  • If you are being given an internal IP address then there is no way to get a location other than manually calling an external service to find out where you are or assigning a default. – DavidG Jul 19 '17 at 13:52

1 Answers1

0

If the case is them installing your software on their servers would it not be easier to record what the location is at installation time or on application start.

No need then to read on each and every call. http://bot.whatismyipaddress.com/ called once and stored in app memory would suffice.

I am also assuming that the clients of this installed software will be in the same location. Almost certainly if they have local ip addresses.

dove
  • 20,469
  • 14
  • 82
  • 108
  • The trouble is that some customers take our services from our cloud solution, some still take it as an on-premise install. I need to write one solution for all! I guess what I'd like to do is detect if the IP is internal or not, and if it is, not bother to return the IP letting the 3rd party work it out from their inbound traffic. – JimFR Jul 20 '17 at 14:05