4AspNet IPInfo v1.0

IPInfo Class

Provides functionality to retrieve country information by Internet Protocol (IP) address, host name or by country code.

For a list of all members of this type, see IPInfo Members.

System.Object
   IPInfo

public sealed class IPInfo : IDisposable

Thread Safety

This type is safe for multithreaded operations.

Remarks

The IPInfo is a central class of the product. It is provides methods for retrieving country information by IP address, host name or by country code.

Note   Before using of IPInfo object make sure what LicenseKey property of License class is set to correct license key string; otherwise the exception of type License.LicenseException will be thrown during initializing of a new instance of IPInfo object.

Overloaded method GetInfoByHostAddress is used to get a country information by a IP address or a host name while method GetInfoByCountryCode allows to retrieve information by country ISO code.

Example

The following example demonstrates using of IPInfo.

public string GetCountryName(string address)
{
    License.LicenseKey = "<put license string here>";
    IPInfo ipi = new IPInfo();
    CountryInfo ci = ipi.GetInfoByHostAddress(address);

    return ci.CountryName;
}

Requirements

Namespace: ForAspNet.IPInfo

Assembly: 4AspNet.IPInfo (in 4AspNet.IPInfo.dll)

See Also

IPInfo Members | ForAspNet.IPInfo Namespace