Helpful Information
 
 
Category: ASP Programming
getting clients country

what is the easiest way to get the clients country, wthout asking them for it............is there a HTTP request?

Thanks

D6

The IP addresses are a location-less protocol and so there is no sure way of finding out what country a user is from. The only you can maybe do it is to do a dns lookup on the ip address and get the country code from the domain but that is not very reliable.

yeah...i was hoping there was another way......

You can read out the HTTP Header "Accept Language". This field has a list of language codes prefered as a response to the request.

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.

Example:

Accept-Language: da, en-gb;q=0.8, en;q=0.7

would mean: "I prefer Danish, but will accept British English and other types of English."

Or you could just get them to fill out a form.










privacy (GDPR)