IsValidIP Method (.NET)

 

This method is used to determine whether a specified string represents a properly formed IP address (four octets, separated by periods, from 0 – 255). This is a static method.

Syntax:

 bIsValidIP = CountryObj.IsValidIP(ipAsString)

The ipAsString parameter is used to specify the string representing an IP address to be checked.

Returns:

True if the string represents a properly formatted IP address, false otherwise.

VB.NET Example:

 

Response.Write("The IP address of 207.12.14.10 is ")

if (CountryObj.IsValidIP("207.12.14.10") = false)

Response.Write("NOT ")

end if

Response.Write("valid.")

C# Example:

 

Response.Write("The IP address of 207.12.14.10 is ");

if (CountryObj.IsValidIP("207.12.14.10") == false)

Response.Write("NOT ");

Response.Write("valid.");