Find Visitor Geographical location from IP address using ASP

Find Visitor Geographical location from IP address using ASP

http://www.codetoad.com/asp_geoip.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:

Select All Code

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值