Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question

2 Answers

up vote 1 down vote accepted

Just found a solution.

    For i = 0 To addresess.Length - 1
        NC.Add("to[" & i & "]", addresess(i))
    Next

use an index and the same keyName

Help came from here : POST'ing arrays in WebClient (C#/.net)

share|improve this answer

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?

share|improve this answer
sorry i get a 400 error not 404 – CharlesO Oct 29 '11 at 21:10
Ah, that makes a difference. According to comments in this post stackoverflow.com/questions/5227425/… that could mean a bad user name and password. – competent_tech Oct 29 '11 at 21:17
hi, no my authentication is correct. i found a solution stackoverflow.com/questions/3942427/… – CharlesO Oct 29 '11 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.