0

I have been struggling with reliably getting the client public IP in an asp.net 2.0 application.

When i use this http://jsonip.appspot.com/?callback=getip service, i have found that it can randomly become unreachable & will through the following message & this becomes a show stopper for my application.

"Over Quota

This application is temporarily over its serving quota. Please try again later."

I have tried another alternative service here http://l2.io/ip.js?var=userip. This isn't reliable either as it also can randomly be unreachable.

Has any one here ever hard a requirement to get the client public IP and implemented a reliable solution?

StackTrace
  • 9,190
  • 36
  • 114
  • 202
  • If you want to get it in code behind then this might help you http://stackoverflow.com/questions/19285957/how-to-get-public-ip-address-of-a-user-in-c-sharp – Mahesh Feb 03 '15 at 06:13

1 Answers1

1

To gain more reliability you could use multiple APIs. As soon as one of them does not respond within a given timeout you switch to another API. Here is an overview of IP 2 Location APIs: https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/6d883a71b7787e2c68e28f43f6afbaffdb27c679/README.md#attribution

Another possibility would be to keep a local copy of the MaxMind GeoLite database and get your results from this database instead of an API. You'll find more information on this here: http://dev.maxmind.com/geoip/geoip2/downloadable/#MaxMind_APIs

And last but not least you can setup your own API. Various APIs like freegeoip.net or my own geoip.nekudo.com are open source so you can host your own copy.

nekudo
  • 107
  • 4
  • Thanks for the github link. Now about using multiple APIs, i run into an issue and posted a question here on SO but it has no answer so far, or do you know of a better implementation. This is the question http://stackoverflow.com/questions/28235537/how-to-dynamically-call-or-reference-scripts-in-aspx-file – StackTrace Feb 05 '15 at 04:45