Uri.PathAndQuery Uri.PathAndQuery Uri.PathAndQuery Uri.PathAndQuery Property

定义

获取用问号 (?) 分隔的 AbsolutePathQuery 属性。Gets the AbsolutePath and Query properties separated by a question mark (?).

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

属性值

一个 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)和 query (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");
 
 Console.WriteLine(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属性包含服务器上的绝对路径,以及与请求一起发送的查询信息。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.

默认情况下,根据 RFC 2396 对属性进行转义。PathAndQueryThe PathAndQuery property is escaped according to RFC 2396 by default. 如果启用了国际资源标识符(IRIs)或国际化域名(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.

适用于