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

前端 未结 5 2053
傲寒
傲寒 2020-12-01 10:02

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

5条回答
  •  忘掉有多难
    2020-12-01 10:36

    If you have a querystring ONLY represented as a string, use HttpUtility.ParseQueryString to parse it into a NameValueCollection.

    However, if this is part of a HttpRequest, then use the already parsed QueryString-property of your HttpRequest.

提交回复
热议问题