CountryCode Property (.NET)

The CountryCode property returns the two-letter country code for which the particular instance of the CountryObj class contains data for. The return value is always in uppercase.

Syntax:

 countryCodeAsStr = chObj.CountryCode

Returns:

String representing the two-letter country code which the particular instance of the CountryObj class contains data for. For example, "US" for United States and "CA" for Canada. These two-letter country codes are defined in your countrynames.properties file.

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.asp sample for more information.

Note: This property is read-only.