C# Uri Authority
Description
Uri Authority
gets the Domain Name System (DNS) host name
or IP address and the port number for a server.
Syntax
Uri.Authority
has the following syntax.
public string Authority { get; }
Example
The following example writes the host name and port number (8080) of the server to the console.
/* w ww .j ava 2 s . c om*/
using System;
public class MainClass{
public static void Main(String[] argv){
Uri baseUri = new Uri("http://www.java2s.com:8080/");
Uri myUri = new Uri(baseUri,"shownew.htm?date=today");
Console.WriteLine(myUri.Authority);
}
}
The code above generates the following result.