0

Assume We have WebService like which accept a lot of parameters, different kinds of parameters with different type of values of parameters.

"https://contoso.com/sab/service.jssp?Param=Normal & JSONOBJECT=JSPJsonObj

How can I build URI with parameters in easy way? For example join parameters or create parameters with %20% format, or even may be create parameters like

oq=Microsoft+Access+Locks+Tables

Here I tried to build URI

    UriBuilder uriBuilder = new UriBuilder("https", "contoso.com", 8080, "service.jssp", "Param=Normal && JSONOBJECT=ITBS_UCN");
uriBuilder.Query += "Param3 = 3"

    Uri uri = uriBuilder.Uri;

As far as I understand Query parameters in browsers have different formatting rules, but I can NOT find class in .NET which encapsulate all these rules.

For example some of parameters are Json objects, some of them even binary encoded.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
justromagod
  • 933
  • 9
  • 20
  • bellow link will help you, please have a look https://stackoverflow.com/questions/17096201/build-query-string-for-system-net-httpclient-get/17096289 –  Feb 06 '19 at 09:39
  • That should probably be the duplicate – TheGeneral Feb 06 '19 at 09:40
  • It is almost duplicate, sry, I tried to search similar question, but was not able to find link about 17096201. Thx – justromagod Feb 06 '19 at 09:45
  • HttpUtility have something to work with Query, but .NET defently need some cleanup in related to Query URL parameters parsing. – justromagod Feb 07 '19 at 09:08

0 Answers0