ip2location facebbook  ip2location twitter  ip2location google+ ip2location github

IP2Proxy .NET Component

This .NET component supports all IP2Proxy™ BIN database products to query proxy IP address and its country, region, city, ISP name and proxy types. It has been optimized for speed and memory utilization.

GitHub Repository: https://github.com/ip2location/ip2proxy-dotnet

 

IP2Proxy .NET class is available for download through NuGet, a Visual Studio extension that allows the users to search, install, remove and update the packages from the NuGet central package repository.

NuGet Package Repository: https://www.nuget.org/packages/IP2Proxy/
Installation
To install IP2Proxy, run the following command in the Package Manager Console
 
			PM> Install-Package IP2Proxy
			

 

Sample Codes
Example VB.NET Codes To Call The IP2Proxy Component
Imports System.IO

Module TestIP2Proxy

    Sub Main()
        Dim proxy As New IP2Proxy.Component
        Dim all As IP2Proxy.ProxyResult

        Dim isproxy As Integer
        Dim proxytype As String
        Dim countryshort As String
        Dim countrylong As String
        Dim region As String
        Dim city As String
        Dim isp As String

        Dim ip As String = "221.121.146.0"

        If proxy.Open("C:\data\IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.BIN", IP2Proxy.Component.IOModes.IP2PROXY_MEMORY_MAPPED) = 0 Then
            Console.WriteLine("GetModuleVersion: " & proxy.GetModuleVersion())
            Console.WriteLine("GetPackageVersion: " & proxy.GetPackageVersion())
            Console.WriteLine("GetDatabaseVersion: " & proxy.GetDatabaseVersion())

            ' reading all available fields
            all = proxy.GetAll(ip)
            Console.WriteLine("Is_Proxy: " & all.Is_Proxy.ToString())
            Console.WriteLine("Proxy_Type: " & all.Proxy_Type)
            Console.WriteLine("Country_Short: " & all.Country_Short)
            Console.WriteLine("Country_Long: " & all.Country_Long)
            Console.WriteLine("Region: " & all.Region)
            Console.WriteLine("City: " & all.City)
            Console.WriteLine("ISP: " & all.ISP)

            ' reading individual fields
            isproxy = proxy.IsProxy(ip)
            Console.WriteLine("Is_Proxy: " & isproxy.ToString())

            proxytype = proxy.GetProxyType(ip)
            Console.WriteLine("Proxy_Type: " & proxytype)

            countryshort = proxy.GetCountryShort(ip)
            Console.WriteLine("Country_Short: " & countryshort)

            countrylong = proxy.GetCountryLong(ip)
            Console.WriteLine("Country_Long: " & countrylong)

            region = proxy.GetRegion(ip)
            Console.WriteLine("Region: " & region)

            city = proxy.GetCity(ip)
            Console.WriteLine("City: " & city)

            isp = proxy.GetISP(ip)
            Console.WriteLine("ISP: " & isp)
        Else
            Console.WriteLine("Error reading BIN file.")
        End If
        proxy.Close()


    End Sub

End Module
Example C# Codes To Call The IP2Proxy Component
namespace TestIP2ProxyComponent
{
    class TestIP2Proxy
    {
        static void Main(string[] args)
        {
            IP2Proxy.Component proxy = new IP2Proxy.Component();
            IP2Proxy.ProxyResult all;

            int isproxy;
            string proxytype;
            string countryshort;
            string countrylong;
            string region;
            string city;
            string isp;

            string ip = "221.121.146.0";

            if (proxy.Open("C:\\data\\IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.BIN", IP2Proxy.Component.IOModes.IP2PROXY_MEMORY_MAPPED) == 0)
            {
                System.Console.WriteLine("GetModuleVersion: " + proxy.GetModuleVersion());
                System.Console.WriteLine("GetPackageVersion: " + proxy.GetPackageVersion());
                System.Console.WriteLine("GetDatabaseVersion: " + proxy.GetDatabaseVersion());

                // reading all available fields
                all = proxy.GetAll(ip);
                System.Console.WriteLine("Is_Proxy: " + all.Is_Proxy.ToString());
                System.Console.WriteLine("Proxy_Type: " + all.Proxy_Type);
                System.Console.WriteLine("Country_Short: " + all.Country_Short);
                System.Console.WriteLine("Country_Long: " + all.Country_Long);
                System.Console.WriteLine("Region: " + all.Region);
                System.Console.WriteLine("City: " + all.City);
                System.Console.WriteLine("ISP: " + all.ISP);

                // reading individual fields
                isproxy = proxy.IsProxy(ip);
                System.Console.WriteLine("Is_Proxy: " + isproxy.ToString());

                proxytype = proxy.GetProxyType(ip);
                System.Console.WriteLine("Proxy_Type: " + proxytype);

                countryshort = proxy.GetCountryShort(ip);
                System.Console.WriteLine("Country_Short: " + countryshort);

                countrylong = proxy.GetCountryLong(ip);
                System.Console.WriteLine("Country_Long: " + countrylong);

                region = proxy.GetRegion(ip);
                System.Console.WriteLine("Region: " + region);

                city = proxy.GetCity(ip);
                System.Console.WriteLine("City: " + city);

                isp = proxy.GetISP(ip);
                System.Console.WriteLine("ISP: " + isp);
            }
            else
            {
                System.Console.WriteLine("Error reading BIN file.");
            }
            proxy.Close();

        }
    }
}

 

IP2Proxy LITE BIN Database

Developers may subscribe the free IP2Proxy LITE BIN database for testing and evaluation purpose. Please take note that the LITE database is limited to public proxies (PUB) IP address. Commercial databases consist of other proxy types such as Tor, VPN and etcs.