Detecting country

Results 1 to 2 of 2

Thread: Detecting country

  1. #1
    Join Date
    Dec 1969

    Default Detecting country

    Is it me, Or am i missing something.<BR><BR>It seems incredibly easy to detect the users language preference, but a right pain in the butt to try n detect the users location?<BR><BR>Whats more the country select list is just down the page from the language select list on the control panel language and regional settings, so if .net finds it so easy to get one setting why not the (proberbly more usefull) one beneath it.<BR><BR>I found the RegionInfo class, and thought i was onto something then, But all that does is return country formmatting data, and you need to know the country before you use it.<BR><BR>Ive decided to take the following approach, but im gonna wait a few days first to give you guys a chance to tell me theres a better way of doing it. (preferebly one line of code like request.userlanguage)<BR><BR>I was gonna map my culture database to ISO 2 or 3 letter country codes, then upon detecting the users culture perform a query to find the corresponding country. Obviously this could cause problems by people living in one location and speaking another language, but im planning on having the option to change from an auto detected country.<BR><BR>If anyone knows a better way, (not IP lookup) please let me know.<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Detecting country

    request.servervariables("HTTP_ACCEPT_LANGUAGE") will at least show what language of browser they are using. You can then default to that. Beyond that you need to provide a language selector in your pages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts