HostNameType Property

Uri.HostNameType Property


Gets the type of the host name specified in the URI.

Namespace:   System
Assembly:  System (in System.dll)

Public ReadOnly Property HostNameType As UriHostNameType

Property Value

Type: System.UriHostNameType

A member of the UriHostNameType enumeration.

Exception Condition

This instance represents a relative URI, and this property is valid only for absolute URIs.

The following example creates a Uri instance and writes the HostNameType to the console.

Dim address1 As New Uri("")
Console.WriteLine("address 1 {0} a valid scheme name", IIf(Uri.CheckSchemeName(address1.Scheme), " has", " does not have")) 'TODO: For performance reasons this should be changed to nested IF statements

If address1.Scheme = Uri.UriSchemeHttp Then
    Console.WriteLine("Uri is HTTP type")
End If 

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
© 2016 Microsoft