How can I access the entire query string in an ASP

2019-06-21 23:21发布

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?

1条回答
我命由我不由天
2楼-- · 2019-06-21 23:54

Use Request.QueryString for this

Request.QueryString.Keys gives you the name of all parameters

查看更多
登录 后发表回答