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.
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.
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).
- There is a limit to URL length of 255 characters.
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]); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With