Best way to convert query string to dictionary in C#

前端 未结 13 947
温柔的废话
温柔的废话 2020-12-24 04:28

I\'m looking for the simplest way of converting a query string from an HTTP GET request into a Dictionary, and back again.

I figure it\'s easier to carry out various

13条回答
  •  借酒劲吻你
    2020-12-24 05:14

    I stumbled across this post whilst looking for the same solution for an Azure WebJob, hopefully this helps others doing the same.

    If you are coding an Azure WebJob you use the GetQueryParameterDictionary() extension method.

    var queryParameterDictionary = request.GetQueryParameterDictionary();
    

    where request is of type HttpRequest and queryParameterDictionary is now of type IDictionary

提交回复
热议问题