Uri.PathAndQuery Property


取得以問號 (?) 分隔的 AbsolutePathQuery 屬性。Gets the AbsolutePath and Query properties separated by a question mark (?).

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

Property Value


String,包含以問號 (?) 分隔的 AbsolutePathQuery 屬性。A String that contains the AbsolutePath and Query properties separated by a question mark (?).


這個執行個體代表相對的 URI,而這個屬性只適用於絕對 URI。This instance represents a relative URI, and this property is valid only for absolute URIs.


下列範例會將 URI 路徑(/catalog/shownew.htm)和查詢(date = today)資訊寫入主控台。The following example writes the URI path (/catalog/shownew.htm) and query (date= today) information to the console.

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");

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


PathAndQuery 屬性包含伺服器上的絕對路徑,以及隨要求傳送的查詢資訊。The PathAndQuery property contains the absolute path on the server and the query information sent with the request. 這等同于串連 AbsolutePathQuery 屬性。It is identical to concatenating the AbsolutePath and Query properties.

根據預設,PathAndQuery 屬性會根據 RFC 2396 進行轉義。The PathAndQuery property is escaped according to RFC 2396 by default. 如果已啟用國際資源識別碼(鳶尾花)或國際化功能變數名稱(IDN)剖析,PathAndQuery 屬性會根據 RFC 3986 和 RFC 3987 進行轉義。If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the PathAndQuery property is escaped according to RFC 3986 and RFC 3987.

如需 IRI 支援的詳細資訊,請參閱 Uri 類別的「備註」一節。For more information on IRI support, see the Remarks section for the Uri class.

Applies to