The GetCountry method is used to return the immutable instance of the CountryObj object associated with a particular IP address. Once you have the CountryObj instance you can then get information associated with the IP address, including the country or origin, country name, and total number of hits from that country. This is a static method.
Syntax:
countryInfo = CountryObj.GetCountry()
Returns the immutable CountryObj instance associated with the current web site visitor's country. This method signature if only callable from ASP.NET
countryInfo = CountryObj.GetCountry(string)
Returns the immutable CountryObj instance for the specified IP address in string format.
countryInfo = CountryObj.GetCountry(System.Net.IPAddress)
Returns the immutable CountryObj instance for the specified IP address.
Returns:
The immutable CountryObj instance for a particular IP address.
VB.NET Example:
dim chObj as CountryObj = CountryObj.GetCountry()
Response.Write("Your country code is: " + chObj.CountryCode)
chObj = CountryObj.GetCountry("207.46.230.220")
Response.Write("<br>Country code for 207.46.230.220 is: " + chObj.CountryCode)
C# Example:
CountryObj chObj = CountryObj.GetCountry();
Response.Write("Your country code is: " + chObj.CountryCode);
chObj = CountryObj.GetCountry("207.46.230.220");
Response.Write("<br>Country code for 207.46.230.220 is: " + chObj.CountryCode);
Note: See the ch_basics_vb.aspx sample for more information.