Visitor API has built-in provider to find visitor's location based on their IP Address.
To configure the IP2Location Database, you need add the following code to the Startup.cs file in your Web API application.
C# |
Copy Code
|
---|---|
public void ConfigureServices(IServiceCollection services) { // ... services.ConfigureVisitor(builder => { builder.UseIp2Location(*ip2LocationConnectionString*); }); } |
As shown in the code above, Visitor API requires a ConnectionString to the Ip2Location database. It works with ip-country-region-city-latitude-longitude-zipcode-timezone database and MS SQL server. You can easily set up the database by following their instructions.