Handling Multiple QueryString Parameters With the Same Key in ASP.NET
When you are processing an HTTP request in ASP.NET you can retrieve the user-provided query string parameters using the HttpRequest.QueryString property. This property is an instance of the NameValueCollection class.
If the user has provided multiple parameters with the same key in the query string, HttpRequest.QueryString[key]
will return all the values concatenated together with commas. If you would rather process the values individually, use HttpRequest.QueryString.GetValues(key)
, which will return an array of all the provided values.
For example:
URL: http://example.com?a=1&a=2
|
|