Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Country of client workstation 2

Status
Not open for further replies.

gus121

Technical User
Joined
May 9, 2002
Messages
298
Location
GB
How would I be best detecting the clients country in the world so I can change the currency for them.
Should I use Javascript or ASP.

Angus
 
You can detect where they are by reading their locale identifier... session.LCID For a list of LCIDs:




Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Excellent it seems to work for me. How can I fool the session.LCID to think I am from different Country for testing. I tryed changing the time zone but this did not work. thanks

Angus
 
I get 2057 - I'm in the US.

You can set the ID like this - session.LCID = 1000

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Thanks but 2057 is the UK. I want a method of detecting the clients location not the server location. so this is of little use.
Is it?

Angus
 
Are you following the code that is written in the first link I gave you? You should not, it uses the global.asa file to set the LCID for each session, which will make all sessions "2057" if you follow their example.

Do not set it at all and then let's try your test again...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
No I am not. Wait I will check the global.asa file to see if the LCID.session is set

Angus
 
Is your code like this?

response.write session.LCID



Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
yes. And session.LCID was been set in the global.asa thanks

Angus
 
Hey, now I get

Your Session.LCID Number is: 2048

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Excellent. Any ideas why the previous web developer would set the Session.LCID as fixed LCID number?

Angus
 
Hi mwolf perhaps gary's solution is the only solution because I cant find 2048 in any of those LCID lists you gave me.

Angus
 
maybe you need to look a little closer [wink] joking!


this link has this particulat format you referenced being used for a example. actually a click away from mwolf00's link

_________________________________________________________
$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;

onpnt2.gif
[/sub]
 
2048 is what i get as well

Angus
 
OK - So 2048 is the default. This does not help me determine the country the client is from.

Angus
 
I believe that 2048 is US, what do you get there in the UK?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Nice find onpnt!

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top