Uri.CheckHostName Method
Determines whether the specified host name is valid.
[Visual Basic] Public Shared Function CheckHostName( _ ByVal name As String _ ) As UriHostNameType [C#] public static UriHostNameType CheckHostName( string name ); [C++] public: static UriHostNameType CheckHostName( String* name ); [JScript] public static function CheckHostName( name : String ) : UriHostNameType;
Parameters
- name
- The host name to validate.
Return Value
A UriHostNameType that indicates the type of the host name. If the type of the host name cannot be determined, or the host name is a null reference (Nothing in Visual Basic) or a zero-length string, returns Unknown.
Remarks
The CheckHostName method checks that the host name provided meets the requirements for a valid Internet host name. It does not, however, perform a host-name lookup to verify the existence of the host.
Example
The following example checks the host name is checked for validity.
[Visual Basic] Console.WriteLine(Uri.CheckHostName("www.contoso.com")) [C#] Console.WriteLine(Uri.CheckHostName("www.contoso.com")); [C++] Console::WriteLine(__box(Uri::CheckHostName(S"www.contoso.com"))); [JScript] Console.WriteLine(Uri.CheckHostName("www.contoso.com"));
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard