Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Uri.Authority Property

Gets the Domain Name System (DNS) host name or IP address and the port number for a server.

[Visual Basic]
Public ReadOnly Property Authority As String
[C#]
public string Authority {get;}
[C++]
public: __property String* get_Authority();
[JScript]
public function get Authority() : String;

Property Value

A string containing the server DNS host name or IP address and the service port number.

Remarks

The Authority property returns the fully qualified DNS host name or IP address of the server specified in the URI, along with the port number for nondefault ports.

Example

The following example writes the host name (www.contoso.com) and port number (8080) of the server to the console.

[Visual Basic] 
Dim baseUri As New Uri("http://www.contoso.com:8080/")
Dim myUri As New Uri(baseUri,"shownew.htm?date=today")
       
Console.WriteLine(myUri.Authority)


[C#] 
Uri baseUri = new Uri("http://www.contoso.com:8080/");
Uri myUri = new Uri(baseUri,"shownew.htm?date=today");

Console.WriteLine(myUri.Authority);
  

[C++] 
Uri* baseUri = new Uri(S"http://www.contoso.com:8080/");
Uri* myUri = new Uri(baseUri,S"shownew.htm?date=today");
 
Console::WriteLine(myUri->Authority);

[JScript] 
var baseUri : Uri = new Uri("http://www.contoso.com:8080/");
var myUri : Uri = new Uri(baseUri,"shownew.htm?date=today");
Console.WriteLine(myUri.Authority);

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

See Also

Uri Class | Uri Members | System Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft