다음을 통해 공유


Uri.Authority 속성

정의

DNS(도메인 이름 시스템) 호스트 이름 또는 IP 주소와 서버의 포트 번호를 가져옵니다.

public:
 property System::String ^ Authority { System::String ^ get(); };
public string Authority { get; }
member this.Authority : string
Public ReadOnly Property Authority As String

속성 값

이 인스턴스가 나타내는 URI의 기관 구성 요소입니다.

예외

이 인스턴스는 상대 URI를 나타내며 이 속성은 절대 URI에 대해서만 유효합니다.

예제

다음 예제에서는 서버의 호스트 이름(www.contoso.com) 및 포트 번호(8080)를 콘솔에 씁니다.

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

Console.WriteLine(myUri.Authority);
open System

let baseUri = Uri "http://www.contoso.com:8080/"
let myUri = Uri(baseUri, "shownew.htm?date=today")

printfn $"{myUri.Authority}"
Dim baseUri As New Uri("http://www.contoso.com:8080/")
Dim myUri As New Uri(baseUri,"shownew.htm?date=today")
       
Console.WriteLine(myUri.Authority)

설명

속성 Authority 은 일반적으로 서버 DNS 호스트 이름 또는 IP 주소입니다. 이 속성은 URI의 기본 포트와 다른 경우 서비스 포트 번호를 포함할 수 있습니다. 구성 요소에 Authority 예약된 문자가 포함된 경우 이 속성에서 반환된 문자열 값에서 이스케이프됩니다.

적용 대상