IsRestricted Method

The IsRestricted method is used to determine whether a country is within a list of restricted countries that you define.

Syntax:

 IsRestricted = chObj.CountryCode [restrictedCountryCodesAsStr]

RestrictedCountryCodesAsStr: Optional. If specified, this must contain a list of valid country codes separated by spaces (i.e. "US CA UK").

Returns:

Returns True if the CountryCode property for chObj is contained within a list of country codes. If no parameter is specified for restrictedCountryCodesAsStr, the list of restricted country codes is obtained from the restricted.hosts section of the countries.properties file. Otherwise it is checked against the list passed in with this parameter.

Example:

<%

'By default the countries.properties file contains a list of terrorist

'sponsored nations according to the U.S. State Department. This code

'checks to see whether the country is within that list, and redirects

'the user if so.

set chObj = Server.CreateObject("cyScape.countryObj")

if chObj.IsRestricted() then

 response.redirect "/noaccess.asp"

end if

%>

<html> Access granted - page content goes here</html>

Note: CountryHawk does not deny access for restricted countries. If you wish to deny or restrict access based on specific countries, you must use this method to determine whether the country is restricted and then restrict access yourself, such as with a redirect to a no access page.

Note: CountryHawk is close to 100% accurate, but is not 100% accurate. If it is critical that you deny or restrict access with 100% certainty based on country, you should not rely solely on CountryHawk to do so.

See Also:

About the Properties and Methods Guide

CountryCode property

RegionCode Property

IPAddr property

Initialize method

CountryName method

RegionName Method

GetSelectList method

IsValidIP method

RegionNameFromCountryCode Method

IsInList method

About the sample scripts

CountryStats Object Properties and Methods

RegionStats Object Properties and Methods