Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何使用WebClient.UploadValues方法通过HTTP POST发送字符串数组?_.net_Arrays_Http Post_Webclient_Sendgrid - Fatal编程技术网

.net 如何使用WebClient.UploadValues方法通过HTTP POST发送字符串数组?

.net 如何使用WebClient.UploadValues方法通过HTTP POST发送字符串数组?,.net,arrays,http-post,webclient,sendgrid,.net,Arrays,Http Post,Webclient,Sendgrid,我需要使用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", "me@world.com") NC.Add

我需要使用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", "me@world.com")
        NC.Add("subject", "testing...")
        NC.Add("body", "testing...again")
        NC.Add("to", string_array)
我已经尝试了几种方法,但我不断得到-远程服务器返回了一个错误:(400)错误的请求


我正在通过他们的WebAPI发布到SendGrid,如果您收到的是404,那么这很可能意味着您的应用程序中针对他们服务的URL不正确或者服务当前未运行。能否复制应用程序中的URL并将其粘贴到浏览器地址区域,以查看是否可以直接访问它?

刚刚找到了一个解决方案

    For i = 0 To addresess.Length - 1
        NC.Add("to[" & i & "]", addresess(i))
    Next
使用索引和相同的键名


来自这里的帮助:

啊,这很重要。根据这篇文章中的评论,这可能意味着用户名和密码不正确。嗨,没有我的身份验证是正确的。我找到了解决办法