I need to get the server’s IP address so that this can be sent along with a Key/Value string collection to a Payment Gateway provider.
I’m running localhost, and Request.ServerVariables["LOCAL_ADDR"] is returning ::1
The validation error I’m getting is returned from Sage Pay:
The ClientIPAddress format is invalid. Should not include leading
zero”s, and only include values in the range of 0 to 255.
Why is this, and how do I get a valid IP address to send?
Disable IPv6 on your local network adapter. ::1 means ‘LOCALHOST’in IPv6. Then you’ll get the normal IPv4 127.0.0.1
Anyway ::1 is a *VALID* IP address..
More on LOCALHOST definition: http://en.wikipedia.org/wiki/Localhost