Uri.AbsolutePath 屬性

定義

取得 URI 的絕對路徑。

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

屬性值

String

資源的絕對路徑。

例外狀況

這個執行個體代表相對的 URI,而這個屬性只適用於絕對 URI。

範例

下列範例會將路徑 /catalog/shownew.htm 寫入主控台。

Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
Console::WriteLine( myUri->AbsolutePath );
Uri baseUri = new Uri("http://www.contoso.com/");
Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");

Console.WriteLine(myUri.AbsolutePath);
open System

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

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

備註

屬性 AbsolutePath 包含伺服器用來解析資訊要求的路徑資訊。 一般而言,這是伺服器檔案系統上所需資訊的路徑,但它也可以指出伺服器必須執行的應用程式或腳本來提供資訊。

路徑資訊不包含 URI 的配置、主機名稱或查詢部分。

適用於