Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.27/5 (4 votes)
See more:
hi all,

how to Get country, state, zip code and Latitude and Longitude from an ip address?

is there free api is available which is in working condition? i have tried so many apis but it didn't work for me.

if it is google api then it is most preferable.

Thanks,
kk
Posted
Updated 17-Sep-13 0:18am
v2

You may look for a (possibly free) webservice.
Google[^] is your friend.
 
Share this answer
 
Comments
Dholakiya Ankit 17-Sep-13 6:20am    
:thumbs up:
CPallini 17-Sep-13 6:29am    
Thanks.
kk2014 17-Sep-13 6:30am    
hi cpallini,

i don;t want to use webservice. i want free api or google api that can solve my problem.

i fed up by searching too much but i dnt get my solution. i have tried apis but some are dont working.

thanks.
Hi,
You found this link.
http://codingresolved.com/discussion/1117/get-location-of-visitor-from-ip-address/p1[^]
Well done.
Now, to find users ip address,
C#
string ipaddress;
ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipaddress == "" || ipaddress == null)
    ipaddress = Request.ServerVariables["REMOTE_ADDR"];

Hope it helps you.
Thanks.
 
Share this answer
 
v2
Comments
kk2014 17-Sep-13 6:20am    
hi harshil,

thanks for the reply. but this link doesn't work for me. i downloaded code and it requires API key. for that i have to register and registration is unavailable,

is there free api is available which is in working condition? i have tried so many apis but it didn't work for me.

thanks.
kk2014 17-Sep-13 7:32am    
hi harshil,

i think ipaddress = Request.ServerVariables["REMOTE_ADDR"]; will work. actually i want to show ISP's address.

thanks,
finally i got solution.

http://codingresolved.com/discussion/1117/get-location-of-visitor-from-ip-address/p1[^]

but how can i get ISP ip address?

thanks.
 
Share this answer
 
Comments
Harshil_Raval 17-Sep-13 6:53am    
Check my 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