[ASN & Company Database] Lookup ASN and Company information from an IP address using the C# programming language.

If you are using the C# programming language and want to look up the ASN and company information of an IP address, you can use our ASN API and IP to Company Service. To get started:

Step 1: Get your access token.

Sign up for the appropriate tier and copy your IPinfo access token from your dashboard.

Step 2: Install the IPinfo C# library

Visit our official open-source IPinfo C# library GitHub repo and follow the instructions to install the library.

Step 3: IPinfo C# library ⇒ IP to Company and ASN

After importing and initializing the IPinfo package, you will need to call the following methods on the IPResponse class variable:

IP to ASN information

Code Description
ipResponse.Asn.Asn ASN of the IP address
ipResponse.Asn.Domain Domain of the ASN
ipResponse.Asn.Name Organization name of the ASN
ipResponse.Asn.Route IP address route or network range of the ASN
ipResponse.Asn.Type Type of ASN

IP to company information

Code Description
ipResponse.Company.Name Name of the company associated with the IP address
ipResponse.Company.Domain Domain / Website of the company
ipResponse.Company.Type Type of company/organization

Starter code template

//namespace
using IPinfo;
using IPinfo.Models;


namespace IPinfoApp {      
    // Class declaration
    class IPlookup {
          
        // Main Method
        static async Task Main(string[] args) {
            
            ////////////////////////////////
            // initializing IPinfo client // 
            ////////////////////////////////
            // Get your IPinfo access token from: ipinfo.io/account/token
            string token = "YOUR_TOKEN";
            IPinfoClient client = new IPinfoClient.Builder()
                .AccessToken(token)
                .Build();


            // making the API call
            string ip = "19.12.136.0";
            IPResponse ipResponse = await client.IPApi.GetDetailsAsync(ip);

            ////////////////////////////
            // ASN / Company Insights //
            ////////////////////////////
            // ASN Information
            Console.WriteLine($"ASN: {ipResponse.Asn.Asn}");
            Console.WriteLine($"ASN Domain: {ipResponse.Asn.Domain}");
            Console.WriteLine($"ASN Name: {ipResponse.Asn.Name}");
            Console.WriteLine($"ASN Route: {ipResponse.Asn.Route}");
            Console.WriteLine($"ASN Type: {ipResponse.Asn.Type}");


            // Company Information
            Console.WriteLine($"Comany Name: {ipResponse.Company.Name}");
            Console.WriteLine($"Comany Domain: {ipResponse.Company.Domain}");
            Console.WriteLine($"Comany Type: {ipResponse.Company.Type}");
        }
    }
}
<br>

Result

ASN: AS3389
ASN Domain: ford.com
ASN Name: Ford Motor Company
ASN Route: 19.12.136.0/21
ASN Type: business


Comany Name: Ford Motor Company
Comany Domain: ford.com
Comany Type: business<br>

Besides the API service, IPinfo’s IP to ASN data and IP to Company data is also available as a database: ASN database download & IP to Company database download.

To learn more about using the C# language and .NET framework with IPinfo, please check out our article: First steps with C#/.NET & IPinfo’s API and Database

If you have any questions, please reach out to us.

Still need help? Contact Us Contact Us