Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get all the querystring name/value pairs into a collection?

Is there a way to get all the querystring name/value pairs into a collection?

I'm looking for a built in way in .net, if not I can just split on the & and load a collection.

like image 297
Blankman Avatar asked Mar 03 '10 22:03

Blankman


People also ask

How do you pass a value in QueryString?

To pass in parameter values, simply append them to the query string at the end of the base URL. In the above example, the view parameter script name is viewParameter1.

What is request QueryString ()?

The value of Request. QueryString(parameter) is an array of all of the values of parameter that occur in QUERY_STRING. You can determine the number of values of a parameter by calling Request. QueryString(parameter).

Which of the following is the limitation of QueryString?

- There is a limit to URL length of 255 characters.


1 Answers

Yes, use the HttpRequest.QueryString collection:

Gets the collection of HTTP query string variables.

You can use it like this:

foreach (String key in Request.QueryString.AllKeys) {     Response.Write("Key: " + key + " Value: " + Request.QueryString[key]); } 
like image 141
Andrew Hare Avatar answered Sep 20 '22 16:09

Andrew Hare