.NET Framework Class Library
HttpRequestQueryString Property

Gets the collection of HTTP query string variables.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)
Syntax
Public ReadOnly Property QueryString As [%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_0_0_0%]
public [%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_1_0_0%] QueryString { get; }
public:
property [%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_2_0_0%]^ QueryString {
	[%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_2_0_1%]^ get ();
}
member QueryString : [%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_3_0_0%] with get
function get QueryString () : [%$TOPIC/ktw1eyx1_en-us_VS_110_1_0_4_0_0%]

Property Value

Type: System.Collections.SpecializedNameValueCollection
The query string variables sent by the client. Keys and values are URL-decoded.
Examples

The following code example shows two ways to get the value of a query string variable named “fullname”. In each case, if the URL is http://www.contoso.com/default.aspx?fullname=Fadi%20Fakhouri, then the value returned is "Fadi Fakhouri" because the %20 is URL-decoded into a space character. If the URL doesn’t have a fullname query string ID, the returned value would be .

The first line of code looks for the key “fullname” only in the query string; the second line looks for the key “fullname” in all of the HTTP request collections. For more information about the second line, see Item.

string fullname1 = Request.QueryString["fullname"];
string fullname2 = Request["fullname"];
Dim fullname1 As String = Request.QueryString("fullname")
Dim fullname2 As String = Request("fullname")
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1