如何使用 WebClient.UploadValues 方法通过 HTTP POST 发送字符串数组?
我需要使用 HTTP Post 发送字符串数组,如下所示...
Dim wc As New Net.WebClient
Dim NC As New Specialized.NameValueCollection
NC.Add("api_user", "some user")
NC.Add("api_key", "some key")
NC.Add("from", "[email protected]")
NC.Add("subject", "testing...")
NC.Add("body", "testing...again")
NC.Add("to", string_array)
我尝试了几种方法,但我不断收到 - 远程服务器返回错误:(400) 错误请求。
我正在通过他们的 WebAPI 发布到 SendGrid
I need to use HTTP Post to send a a string array like so...
Dim wc As New Net.WebClient
Dim NC As New Specialized.NameValueCollection
NC.Add("api_user", "some user")
NC.Add("api_key", "some key")
NC.Add("from", "[email protected]")
NC.Add("subject", "testing...")
NC.Add("body", "testing...again")
NC.Add("to", string_array)
i have tried several methods, but i keep getting - The remote server returned an error: (400) Bad Request.
I'm posting to SendGrid via their WebAPI
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
刚刚找到解决方案。
使用索引和相同的 keyName
帮助来自这里:POST'ing arrays in WebClient (C# /.net)
Just found a solution.
use an index and the same keyName
Help came from here : POST'ing arrays in WebClient (C#/.net)
如果您收到 404,则很可能意味着您的应用程序中的服务 URL 不正确或该服务当前未运行。您能否复制应用程序中的 URL 并将其粘贴到浏览器地址区域中,看看是否可以直接访问它?
If you are receiving a 404, then that most likely means that either the URL in your application for their service is incorrect or the service is not currently running. Can you copy the URL that is in your application and paste it into a browser address area to see if you can access it directly?