Detect a user's country of origin?

Discussion in 'ASP.NET 2.0' started by kj60, Aug 9, 2006.

  1. I need to detect a user's country of origin so that I can differentiate the terminology and spelling used on my site e.g. for visitors from the USA or the UK.

    I understand that this would probably involve an IP/database look up - is this correct? I am new to this area so am looking for any help, pointers, experiences, practical software suggestions etc. Ideally I would like a low (zero? :) ) cost solution. I realise that they may not be 100% accurate but something would be better than nothing.

    Any help appreciated. Thanks in advance.

    Kevin
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. Thanks. I have done some more digging around and found that 'HttpContext.Current.Request.UserLanguages()' from the browser may also help.

    There seems to be some debate about whether to use IP look-up or to try and 'second guess' the preferred country. For example if you are a British user using a browser in an Internet cafe in France on business, do you want the French version? Would it be better for the user to choose their language on the home page? Any experiences, thoughts, preferences on this would be appreciated.

    Kevin
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    well.... it really depends on how important it is to display the customized content.


    'HttpContext.Current.Request.UserLanguages()' only tells you what language the OS is using. On the other hand, if you use IP check, you can pretty much guarantee which country the request is coming from.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Well initially the site I am building is selling a service that uses slightly different terminology (and spelling) for US and UK users. I don't want to lose potential customers because they think the service is not for them because of this terminology difference.

    IP lookup would work for many cases I guess, but not for Americans in the UK or British in the US. I am really trying to poll whether users would prefer to set their own site language preferences (by clicking on a flag on the home page for example) or have the system second guess it.
     
  6. Thanks Joel. I have decided to use 'HttpContext.Current.Request.UserLanguages()' to do the initial detection as I mainly need to differentiate between US and UK. This allows for someone, for example, to use their own laptop in another country - it will set the language of the laptop browser rather than the country they are in. If the language is wrong for the user I will allow them to change it themselves - and a cookie will be set to remember their preference.
     
  7. Using a programatic approach may never be 100% accurate, it will also be more costly to develop and maintain.

    I've seen an used sites that let me switch regions. To me, it's not that big of a deal.


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     

Share This Page