WebClient.UploadValues 重复键
我在代理网站上的请求时遇到一些困难。
理论上,这应该有效
webClient.UploadValues(url, "POST", HttpContext.Current.Request.Form);
不幸的是,该表单包含重复的键“elemKey”
当我使用 HTTP 分析器并查看发布数据时,它显示该键三次,具有三个不同的值。 参数值
elemKey value1 elem键值2 elemKey value3
不幸的是,Web 客户端进行的调用仅显示一次密钥,并使用逗号分隔的值列表,但这是行不通的。
参数值 elemKey value1,value2,value3
我尝试从 HttpContext.Current.Request.Form 变量创建一个 NameValueCollection 并添加多个 elemKey,但同样,只是用逗号将它们连接在一起。
有没有办法可以按照我需要的方式创建此请求?
谢谢 -C
I am having a bit of difficulty proxying 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 HTTP Analyzer and look at the post data it shows that key three times, with three different values.
Parameter Value
elemKey value1
elemKey value2
elemKey value3
Unfortunately, the call the webclient makes shows the key once, with a comma seperated list of values, which does not work.
Parameter Value
elemKey value1,value2,value3
I tried creating a NameValueCollection from the HttpContext.Current.Request.Form variables and adding the multiple elemKeys, but it again, just concatenated them together with commas.
Is there a way I can create this request in the manner I need?
Thanks
-c
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 UploadString 而不是 UploadValues,现在一切正常
string html = webClient.UploadString(url, "POST", HttpContext.Current.Request.Form.ToString());
I used UploadString instead of UploadValues and all is now well
string html = webClient.UploadString(url, "POST", HttpContext.Current.Request.Form.ToString());