Gets the Uri.AbsolutePath and Uri.Query properties separated by a question mark (?).
A string that contains the values of the Uri.AbsolutePath and Uri.Query properties.
The Uri.PathAndQuery property contains the absolute path on the server and the query information sent with the request. It is identical to concatenating the Uri.AbsolutePath and Uri.Query properties.
The Uri.PathAndQuery property is escaped according to RFC 2396 by default. If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the Uri.PathAndQuery property is escaped according to RFC 3986 and RFC 3987.
For more information on IRI support, see the Remarks section for the Uri class.
The following example uses the Uri.PathAndQuery property to extract the path and query information from a Uri instance.
C# Example
using System; public class UriTest { public static void Main() { Uri baseUri = new Uri("http://www.contoso.com/"); Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today"); Console.WriteLine(myUri.PathAndQuery); } }
The output is
/catalog/shownew.htm?date=today