Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,

I've a country drop down and medical category dropdown, when user open the page, in the page load itself I need to make the country selected, based on the user country, Suppose the user is browsing the page from Sigapore then in country drop down singapore should be selected and If user from India then India should be selected, I have found one solution like http://smart-ip.net/geoip-json?callback=?[^] this is returning the country name and so on. This concept is working on IP address, Suppose the IP address is registered by Sigapore and used in India then it is showing Singapore only.

Can i get any other solution to find the country name of the user of my web site?
Is it possible to find through Google API, then how?
Posted
Updated 25-Sep-13 19:58pm
v3

1 solution

First of all,Dropdown is something that gives user a choice to select different items. If you are aimed at single item,DropDown list won't makes sense here for country as you are not providing user to select country.

Further, if you don't want to go with ip then another solution is based on Culture info. See this link.

Blocking an Entire Country from accessing the website In ASP.NET[^]

Once you get the response e.g. US.Get country name and proceed further.

Google Analytics Country Names[^]

Remember, in any case,you can not get 100% accurate results as there are some limitations with every approach.

Regards..
 
Share this answer
 
v2
Comments
Rockstar_ 26-Sep-13 2:28am    
Thank you very much dear..
Rockstar_ 26-Sep-13 2:31am    
If i go with cultureInfo, I think it will be based on the OS settings which we do while OS instllation, If the user has not changed his/her settings, then it will show the selected Country, right?, Because I've tested once with culture info it is showing United States.
Thanks7872 26-Sep-13 2:34am    
Yes.Exactly.
Thanks7872 26-Sep-13 2:38am    
Refer to updated answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900