I know that if I have an url like XController/Action?id=1, and an action method
void Action(int id)
the id parameter will automatically be read from the query string.
But how can I access the entire query string when I don't in advance know the name of all parameters. E.g:
void Action(QueryStringCollection coll) {
object id = coll["id"];
}
Is it possible to do something like this?
Use Request.QueryString for this
Request.QueryString.Keys gives you the name of all parameters
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