![]() Then, we have to refer to HTTP_CLIENT_IP or HTTP_X_FORWARDED_FOR. If the client uses a proxy server or load balancing server, REMOTE_ADDR might represents the Public IP for the proxy server or load balancing server. In normal case, REMOTE_ADDR will represent the real Public IP for the client. IPLite.cs has 3 classes contain the information for the client's Public IP. Response.Write( " Time Zone: " + ip.TimeZone + " ") Ībove code shows an example of using MySQL.įor other database, just modify the source and change the object of Connection, Command, DataAdapter to your data provider's respective object/class. Response.Write( " Zip Code: " + ip.ZipCode + " ") Response.Write( " Longitue: " + ip.Longitude + " ") Response.Write( " Latitue: " + ip.Latitude + " ") Response.Write( " City: " + ip.CityName + " ") Response.Write( " Region: " + ip.RegionName + " ") Response.Write( " Country: " + ip.CountryName + " ") Response.Write( " Country Code: " + ip.Countr圜ode + " ") Response.Write( " IP Number: " + ip.IpNumber + " ") Response.Write( " IP Address: " + ip.IpAddress + " ") The rest of the example in this article will demonstrate by using MySQL.Ĭopy Code private void Displa圜urrentVisitorIpInfo() More instructions for setting up other databases (MSSQL, PostgreSQL) are available at their website. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin " Using (MySqlCommand cmd = new MySqlCommand())Ĭmd.CommandText CREATE TABLE `ip2location_db11`( Using (MySqlConnection conn = new MySqlConnection(connectionString)) A benchmark had been carried out by Kevin van Zonneveld and presents that LOAD DATA is 2000%++ faster than INSERT.Ĭopy Code string file = " C:\\backupfolder\\IP2LOCATION-LITE-DB11.CSV" SQL dump file uses normal INSERT to import dataĪccording to documentation of MySQL on Speed of INSERT Statements, LOAD DATA is 20 times faster than INSERT.There are two common dump files for MySQL. CSV can be imported directly into MySQL server. provides the database in two format, BIN and CSV. ![]() Sample Database Installation Script for MySQL (C#) Personal recommendation is: Restore as another separate dedicated database, don't combine it with your main operating database, but this is up to you to decide. The IP database is updated every month and provides the following data of an IP:ĭownload and restore the database to your server. It ultilises database provided by to identify the Country, Region and City of website's visitors based on their IP address. ![]() I would like to share a small class that is written by me, ( IPLite.cs).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |