Database Search Solution
(New Version) Search Control
Free ASP.NET Controls
ASP.NET Media Player Control
Flash Video Player Control
ASP.NET Telecommute Jobs
Free IP Location Lookup
Test .Net Regular Expressions
CSS/Table/DIV Page Layouts
Article Sites Master List
.NET Windows Forms
General .NET Framework
Accepting Credit Cards
FREE Geo Targeting ASP.NET Component
Geo Targeting component is free ASP.NET component based on C# API of MaxMind. With Geotargeting component you can find out more about location of your web site visitor, like visitor's city or country. You can use this information to display more relevant ads or content to your users.
Free Geo Targeting component features
- Country name
- Country code
- Postal code
- Area code
How to implement geo targeting on your site
To implement geo targeting on your ASP.NET web site, follow these three simple steps:
1. Set up geo targeting database
Download free GeoCity Lite database from here. Unpack it somewhere on your local disk to get GeoLiteCity.dat file. Upload GeoLiteCity.dat file to your web server, for example in /App_Data/ directory.
2. Install Geotargeting Component
First download free Geotargeting .Net Component. Download Getoargeting .Net 1.1 for use with .Net Framework 1.1 web application, or Geotargeting .Net 2 for use with .Net Framework 2.0 or .Net Framework 3.5. Unzip .zip file to get component's dll. Upload dll to your web application's /bin/ folder.
3. Get Visitor City, Country and other information with ASP.NET code
Now everything is ready to use geo targeting on your web site. To get wanted information you can use a code like this:
[ C# ]
public partial class _Default : System.Web.UI.Page
[ VB.NET ]
Partial Class Test_DefaultVB
That is all you need to do! Enjoy in new feature of your web site :)
Common errors during implementation
If you access to sample code through a local area network or through a http://localhost/ you'll get an error "Object reference not set to an instance of an object". Note that this technique doesn't return location information directly, but based on IP address. When you try to run example on http://localhost/ IP address is 127.0.0.1
If you set incorrect path to .dat file, you'll get the same error. In that case check value of FullDBPath variable in example code and check is GeoLiteCity.dat file existing in specified location.
Geo targeting maintenance
Data about IP addresses are not constant. They change over time and database becomes less accurate. Because of that, MaxMind refreshes its databases every month to include those changes and provide correct results. You need to download .dat file once per month and upload it to your web site over old file.
Comparation between free version and commercial version of database
Both databases works on completely same way. You can use Geotargeting component with both editions. However, commercial version have more accurate data. You can see all differences in table at the bottom of this page.