.NET Framework Class Library  

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

[Visual Basic, C#, JScript] 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"));
   

[JScript] 
Console.WriteLine(Uri.CheckHostName("www.contoso.com"));

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

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 - Windows CE .NET, Common Language Infrastructure (CLI) Standard

See Also

Uri Class | Uri Members | System Namespace