Find Where in the World Using IP Address - November 2011
Lots of Hits - One of my domains was getting lots of hits - 20,000 in one day. There should not be more than 500 per day. I needed to find out why there were so many. As it turned out many of the hits were coming from Hong Kong. And some from the Russian Federation. With that knowledge we were able to block IP addresses from those locations in the server's firewall. As part of the research I wrote a web application that accepts an IP address and reports its geographic location. The application becomes the November 2011 tip-of-the-month. Click here to run the demo. The process is documented below.
The Asp.Net, VB.Net, VS/2008 project FindWhereInTheWorldUsingIPAddress is documented using screen captures:
Enter a domain name then click 'Get IP Addresses' to display one or more IP Addresses on the next page.
Or enter an IP Address then click 'Get Location' to get information about the IP address' geographic location.
If you entered a domain name and clicked the option to 'Get IP Addresses' this page is displayed.
Select one of the addresses then click 'Get Location' to display geographic information.
If you entered an IP address and clicked 'Get Location' geographic information is displayed.
The application uses data supplied via a web service from Cdyne Corporation. A WebRequest and WebResponse provide an XML file. The file is converted to a DataTable. I wrote a class module called cFindWhereInTheWorldUsingIPAddress. The module contains the following methods:
Method Description GetLocation(sIPAddress) Returns a DataTable. An XmlTextReader loads the DataTable. GetLocationCollection(sIPAddress) Returns a Collection. The DataTable is converted to a Collection in method 'GetLocationCollection'. Elements of the
collection are defined using this class:
Public sColumnName As String = ""
Public oValue As Object
|CodeProject.com||Article: Easy to Track the Geographical Location Based on IP Address.|
|4GuysFromRolla.com||Article: A Deeper Look at Performing HTTP Requests in an ASP.NET Page.|
|Cdyne.com||Web Service: The Cdyne IP2Geo XML Web Service resolves IP addresses to geographic locations. Requires a license.|
Download the source code by clicking on the zipped file name. Click here to run the demo application.
Download - Source Zipped File Size VS/2008 VB.Net, ASP.Net Solution FindWhereInTheWorldUsingIPAddress.zip 118K
Previous Tip Tip Index Next Tip