HttpUtility.ParseQueryString Method (String, Encoding)

Parses a query string into a NameValueCollection using the specified Encoding.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

static NameValueCollection^ ParseQueryString (
	String^ query, 
	Encoding^ encoding
public static NameValueCollection ParseQueryString (
	String query, 
	Encoding encoding
public static function ParseQueryString (
	query : String, 
	encoding : Encoding
) : NameValueCollection
Not applicable.



The query string to parse.


The Encoding to use.

Return Value

A NameValueCollection of query parameters and values.

Exception typeCondition


query is a null reference (Nothing in Visual Basic).

- or -

encoding is a null reference (Nothing in Visual Basic).

In the returned NameValueCollection, URL-encoded characters are decoded and multiple occurrences of the same query string parameter are listed as a single entry with a comma separating each value.

Security noteSecurity Note:

The ParseQueryString method uses query strings that might contain user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview (Visual Studio).

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions