Solved

IP and Zip Code on asp/mvc app

Posted on 2013-10-25
14
580 Views
Last Modified: 2014-03-19
Two helps from experts.

1. Assume I have a website, and I want to capture the IP from the user.
2. Once the IP is obtained, I want to convert to zip code.

I need some helps how to get both working on MVC 3 asp app.

Thanks
0
Comment
Question by:solution1368
  • 7
  • 6
14 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39602137
You can get the IP address from the SERVER variables.  But an IP address belongs to the ISP, not the individual.  Even if you can convert it, the zip code will be that of the ISP, not the individual.
0
 

Author Comment

by:solution1368
ID: 39602152
That is ok. I still want it.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39602246
For the IP address, you get it from the server variables.  Look for 'remote_address' on this page: http://www.w3schools.com/asp/coll_servervariables.asp

I use MaxMind's free GeoIP services.  http://www.maxmind.com/en/geolocation_landing  I use the PHP version but there is an ASP.NET version on their site also.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:solution1368
ID: 39602973
Thank You. But I hope to find something for free....
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39602995
Look harder at that page.  I'm using the free version.
0
 

Author Comment

by:solution1368
ID: 39603116
no idea how to get it.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39603118
On this page http://dev.maxmind.com/geoip/geoip2/geolite2/ are links for the free databases and the APIs including one for C#.
0
 

Author Comment

by:solution1368
ID: 39603408
Thank. But I don't really want to install any databases. Any API i can use without the database installed?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39603426
All you have to do is upload it.  It is a stand-alone file, not something that goes in an SQL server.  I doubt that there is anything simpler since there is a lot of information to look thru.  The API code reads the info from that database file.
0
 

Author Comment

by:solution1368
ID: 39613176
I don't want to upload those files. A simple service call will be preferable. Thanks
0
 

Author Closing Comment

by:solution1368
ID: 39634639
I finally use your idea. It works.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39634753
Glad to help.
0
 

Author Comment

by:solution1368
ID: 39634906
0
 

Expert Comment

by:brianregal
ID: 39940549
If you are looking for a service I have checked out Location Data.  I think they will meet your needs.  I think they are at locationdata.com
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question