Duplicate Key WebClient.UploadValues

I find it a bit difficult to proxy a request on my site.

In theory this should work

webClient.UploadValues ​​(url, "POST", HttpContext.Current.Request.Form);

Unfortunately, the form contains a duplicate key "elemKey"

When I use an HTTP parser and look at the post data, it shows this key three times, with three different values. Parameter value

ElemKey1 value elemKey2 value elemKey3 value

Unfortunately, the call made by the web client shows one time a comma separated list of values ​​key which doesn't work.

The elemKey parameter value1, value2, value3

I tried to create a NameValueCollection from HttpContext.Current.Request.Form variables and add some elemKeys, but again just concatenated them along with commas.

Is there a way to create this query the way I need it?

Thanks -c

0


source to share


1 answer


I used UploadString instead of UploadValues ​​and now everything is fine.



string html = webClient.UploadString (url, "POST", HttpContext.Current.Request.Form.ToString ());

+1


source







All Articles