A string containing the DNS host name or IP address of the host server. If the host information was not specified to the constructor, the value of this property is string.Empty .
Unlike the Uri.Authority property, this property value does not include the port number.
The following example demonstrates using the Uri.Host property.
C# Example
using System;
public class UriTest {
public static void Main() {
Uri baseUri = new Uri("http://www.contoso.com:8080/");
Uri myUri = new Uri(baseUri, "shownew.htm?date=today");
Console.WriteLine(myUri.Host);
}
}
The output is
www.contoso.com