Home » ASP » Article
Find Visitor Geographical location from IP address using ASP
|
Article by: |
Per Soderlind (2/26/2003) |
|
Sponsored by:
|
FindMyHosting - Web Hosting Search
|
Summary:
|
Where are your internet visitors coming from? Using simple ASP and the free GEOIP Database from Maxmind its quite easy to find out |
|
Viewed: 39917 times |
Rating (11 votes): |
|
4.1 out of 5 |
|
|
Find Visitor Geographical location from IP address using ASP
Download GeoIP files - 6 Kb Online Demo
Introduction
With GeoIP you can detect where your visitors are coming from. You can use this information to deliver personalized information (see image below), reducing credit card fraud, analyzing web server logs (I use it for SNIFF), target banner ads, .... (see Solutions at MaxMind - http://www.maxmind.com/)
Click on the image for a test
Note
If you can install a component on your web server, you should download the GeoIP component from MaxMind . I wrote GeoIP.asp since my provider doesn't allow me to install components.
Prerequisite
You need the GeoIP database - http://www.maxmind.com/app/free, and you need ADO 2.5 or later since GeoIP.asp uses the ADO Stream object to read the GeoIP database.
Installation
Download the GeoIP.dat database from MaxMind
http://www.maxmind.com/app/free
Put GeoIP.asp, example.asp and GeoIP.dat in a catalog on your web server.
Test the installation by accessing the example.asp page
http://yourserver/path/example.asp
Methods and Properties
GeoIP.asp exposes these public methods and properties
Properties:
GeoIPDataBase - Sets the path and filename to GeoIP.dat
ErrNum - Returns the error number (if 0, there's an error)
Methods:
lookupCountryName - Find an IP's country name
example:
strCountryName = oGeoIP.lookupCountryName(strIP)
lookupCountryCode - Find an IP's country code
example:
strCountryCode = oGeoIP.lookupCountryCode(strIP)
Using the code
It's rather simple to use this code:
|
|
View highlighted Comments
User Comments on 'Find Visitor Geographical location from IP address using ASP'
|
Posted by :
Archive Import (pg) at 23:41 on Wednesday, April 23, 2003
|
need geoip.dat
tried at http://www.maxmind.com/download/geoip/database/ but the file therre is geoip.dat.gz
upon clicking it opens some viewer (VRML, I think) but nothing loads.
So, downloaded the file geoip.dat.gz
Upon trying to access locally, again nothing loads but this time there is an error, "Compilation error: Unrecoginsed header string"
Can someone help?
|
|
Posted by :
Archive Import (pg) at 23:45 on Wednesday, April 23, 2003
|
One more question:
Is there a free php solution for resolving IP to Country that I can use on my site?
|
|
Posted by :
Archive Import (maty ponpon) at 23:22 on Monday, April 28, 2003
|
i would like to know how to find a user's IP on a forum (what ever forum it is...)Thanks
|
|
Posted by :
Archive Import (Your Guru) at 15:00 on Sunday, June 01, 2003
|
Nothing special - it only guesses the country I am from. Anything more specific???
|
|
Posted by :
Archive Import (george) at 10:54 on Friday, June 13, 2003
|
Can someone help me please! How does one locate the state location according to IP address. Any info would be welcome :)
|
|
Posted by :
Archive Import (Khalid ) at 07:07 on Monday, July 07, 2003
|
Sure!!!
I just got the answer once I read your question.
Actually I came here through the following web site"
http://soderlind.no/s/geoip/
Once I read your question, I just knew that the guy who used the same function had already downloaded the file, so
I jsut typed
http://soderlind.no/s/geoip/GeoIP.dat
and got the file you need. :)
GL
|
|
|
Posted by :
Archive Import (James Laugesen) at 20:01 on Wednesday, July 23, 2003
|
It's impossible to accurately resolve location from an IP address because the IP is allocated to users by their ISP, which could be located anywhere and have purchased the IP anyway.
A Danish ISP who has a POP in Sydney, Australia can allocate Danish IP's to users in Sydney.
It's sort of fun.
But definatly not a good idea for validating credit card use.
|
|
Posted by :
Archive Import (Amol B Thorat) at 13:34 on Thursday, August 07, 2003
|
Dear Sir/Madam
I want to knw the location of the following ip
202.21.44.137
Kindly help me on this
thanks and regards
Amol Thorat
|
|
Posted by :
Archive Import (nattudurai) at 14:22 on Thursday, August 07, 2003
|
dear Sir/Madam
i want to know about how to administrator give the permission for
user can see the perticular web page..
i'm waiting for u'r kind reply..
thaking u sir..
|
|
Posted by :
Archive Import (Anil) at 09:23 on Sunday, August 17, 2003
|
Dear Sir/Madam,
I want to know the location (exact address) of the following IP Address
202.52.196.216
Hoping that it's posible to you.
Is it possible to locate the address of actual user through ip address?
pls help me.
eagerly waiting for your reply.
thanking u
anil
|
|
Posted by :
Archive Import (anita) at 22:22 on Monday, August 18, 2003
|
i want to detect IP address by known location. how do i do?
|
|
Posted by :
Archive Import (Yo) at 18:46 on Sunday, August 24, 2003
|
I don't live in Norway unless you spell Norway... C,A,N,A,D,A eh!
|
|
Posted by :
Archive Import (Mikey D) at 01:07 on Tuesday, September 02, 2003
|
Hi.
I was wondering how to find a location for an ip address. I tried a couple on the internet using my own ip address and it was giving me a location of virginia when i live in pa. Can someone please help?
|
|
Posted by :
Archive Import (Travis) at 02:32 on Monday, September 15, 2003
|
If possible, please give info on 213.158.72.1
|
|
Posted by :
fadly at 08:55 on Monday, October 20, 2003
|
hi, i was download it. but how know about them have ISP?? like this
IP Address Country (Short) Country (Full) Flag Region City ISP
202.155.59.222 ID INDONESIA - - HOST BATAM MATSUSHITA BATTERY
pls help me
<Added>
hi, i was download it. but how know about them have ISP(in the underlined text and bold?? like this
IP Address Country (Short) Country (Full) Flag Region City ISP
202.155.59.222 ID INDONESIA - - HOST BATAM MATSUSHITA BATTERY
pls help me
|
|
Posted by :
kunlasethi at 06:15 on Monday, April 05, 2004
|
the package on longer contain GeoIp.asp and example in the g file
can anyone mail it to me
kunals_libra@yahoo.com?
|
|
|
To post comments you need to become a member. If you are already a member, please log in .
RELATED ARTICLES |
MagicGrid by Abhijeet Kaulgud
MagicGrid is an all-in-one grid for ASP programmers. It is a 3 Level Hierarchial Grid. You can Add, Edit, Delete Items under all the three levels. You can also cut-copy-paste Items from one level to other, It happens just by drag & drop! |
 |
ASP Format Date and Time Script by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function. |
 |
Creating a Dynamic Reports using ASP and Excel by Jeff Anderson
A simple way to generate Excel reports from a database using Excel. |
 |
ASP Shopping Cart by CodeToad Plus!
Complete source code and demo database(Access, though SQL compatible) to an ASP database driven e-commerce shopping basket, taking the user through from product selection to checkout. Available to CodeToad Plus! Members |
 |
Create an ASP SQL Stored Procedure by Jeff Anderson
A beginners guide to setting up a stored procedure in SQL server and calling it from an ASP page. |
 |
Email validation using Regular Expression by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP. |
 |
The asp:checkbox and asp:checkboxlist control by David Sussman, et al
Checkboxes are similar to radio buttons, and in HTML, they were used to allow multiple choices from a group of buttons. |
 |
Creating an SQL Trigger by Jeff Anderson
A beginners guide to creating a Trigger in SQL Server |
 |
Find Visitor Geographical location from IP address using ASP by Per Soderlind
Where are your internet visitors coming from? Using simple ASP and the free GEOIP Database from Maxmind its quite easy to find out |
 |
ASP.NET Forum Source Code by ITCN
Complete open source website Forum and Discussion Board programmed in Microsoft dot Net 1.1 Framework with Visual Basic. |
 |
|
|