Get geographical location from visitor IP in ASP.NET (CSASPNETIPtoLocation)

The VC# code sample illustrates how to get the visitor's IP address and get the visitor's geographical location from the IP address in ASP.NET

C# (1.7 MB)
 
 
 
 
 
3.8 Star
(6)
35,870 times
Add to favorites
5/26/2011
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • where do we get updated iptoLocation addresses list?
    1 Posts | Last post December 17, 2014
    • If new range of ip's get added, where do we get the updated ip address table entries.
      Is their any service / any site?
      
  • I am also getting this error.
    1 Posts | Last post June 08, 2012
    • I get this error I have SQLEXPRESS  2008 and SQL Server 2008R2
      
      The database 'E:\CSASPNETIPTOLOCATION\CSASPNETIPTOLOCATION\APP_DATA\LOCATION.MDF' cannot be opened because it is version 661. This server supports version 612 and earlier. A downgrade path is not supported.
      
      Could not open new database 'E:\CSASPNETIPTOLOCATION\CSASPNETIPTOLOCATION\APP_DATA\LOCATION.MDF'. CREATE DATABASE is aborted.
      
      An attempt to attach an auto-named database for file E:\CSASPNETIPtoLocation\CSASPNETIPtoLocation\App_Data\Location.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
  • How do I get this data base to open
    2 Posts | Last post May 10, 2012
    • I get this error I have SQLEXPRESS 2005 and 2008
      The database 'E:\CSASPNETIPTOLOCATION\CSASPNETIPTOLOCATION\APP_DATA\LOCATION.MDF' cannot be opened because it is version 661. This server supports version 612 and earlier. A downgrade path is not supported.
      Could not open new database 'E:\CSASPNETIPTOLOCATION\CSASPNETIPTOLOCATION\APP_DATA\LOCATION.MDF'. CREATE DATABASE is aborted.
      An attempt to attach an auto-named database for file E:\CSASPNETIPtoLocation\CSASPNETIPtoLocation\App_Data\Location.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
    • i found a good solution for getting geolocation through IP 
      http://languagelassi.blogspot.in/2012/05/geolocation-through-ip-address.html
      
      and it worked perfect for me
  • Unreachable code
    1 Posts | Last post October 20, 2011
    • There is unreachable code in the following snippet from IPConvert.cs: 
      ************************************
       for (int i = 0; i < 4; i++) 
                      { 
                          int numPosition = int.Parse(ipArray[3 - i].ToString()); 
                          if (i == 4) 
                          { 
                              // Unreachable, as i will never be 4 based on the condition in the outer loop
                              ipRange += numPosition;
                           } 
      ************************************
      
      Thanks for the all the samples!