Uri.PathAndQuery 屬性

定義

取得以問號 (?) 分隔的 AbsolutePathQuery 屬性。

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

屬性值

String

AbsolutePathQuery 屬性會以問號分隔 (?) 。

例外狀況

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

範例

下列範例會將 URI 路徑寫入主控台 (/catalog/shownew.htm) 和查詢 (?date=today) 資訊。

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

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

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

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

備註

屬性 PathAndQuery 包含伺服器上的絕對路徑,以及與要求一起傳送的查詢資訊。 它與串連 AbsolutePathQuery 屬性相同。

根據預設, PathAndQuery 屬性會根據 RFC 2396 逸出。 如果啟用國際資源識別碼 (IRI) 或國際化功能變數名稱 (IDN) 剖析, PathAndQuery 則會根據 RFC 3986 和 RFC 3987 逸出屬性。

如需 IRI 支援的詳細資訊,請參閱 類別的 Uri 一節。

適用於