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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version