Query Property

Uri.Query Property

Gets any query information included in the specified URI.

[Visual Basic]
Public ReadOnly Property Query As String
[C#]
public string Query {get;}
[C++]
public: __property String* get_Query();
[JScript]
public function get Query() : String;

Property Value

A string containing any query information included in the specified URI.

Remarks

The Query property contains any query information included in the URI. Query information is separated from the path information by a question mark (?) and continues to the end of the URI. The query information returned includes the leading question mark.

The query information is escaped according to RFC 2396.

Example

[Visual Basic, C#, C++] The following example writes the query ?date= today to the console.

[Visual Basic] 
Dim baseUri As New Uri("http://www.contoso.com/")
Dim myUri As New Uri(baseUri, "catalog/shownew.htm?date=today")
       
Console.WriteLine(myUri.Query)


[C#] 
Uri baseUri = new Uri("http://www.contoso.com/");
 Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");
 
 Console.WriteLine(myUri.Query);
   
    . . . 
Uri baseUri = new Uri("http://www.contoso.com/");
 Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today");
 
 Console.WriteLine(myUri.Query);
   

[C++] 
Uri* baseUri = new Uri(S"http://www.contoso.com/");
Uri* myUri = new Uri(baseUri,S"catalog/shownew.htm?date=today");
 
Console::WriteLine(myUri->Query);
   

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Uri Class | Uri Members | System Namespace

Show:
© 2016 Microsoft