Sid Price
asked on
upload JSONobject to web server
I am writing a client application for a networked device. The device requires that control values are changed using html "POST" and sending form data containing a JSON object. The devices has some sample commands using CURL that work fine and I am able to capture the "POSTs" using Wireshark. Here is a capture of a good transaction:
I am using VB.NET to write my client application and using WebRequest I can send the value pair but the form data is missing the "json=" part of the data:
This is the code I have so far:
The server rejects the post and closes the connection.
I have searched but cannot find a way to get this data correct. Any pointers would be much appreciated,
Sid.
I am using VB.NET to write my client application and using WebRequest I can send the value pair but the form data is missing the "json=" part of the data:
This is the code I have so far:
Using sendto As New Net.WebClient
Dim param As New Specialized.NameValueCollection
param.Add(theName, theValue)
Dim response_bytes = sendto.UploadValues(uri, "POST", param)
Dim response_body = (New Text.UTF8Encoding).GetString(response_bytes)
End Using
The server rejects the post and closes the connection.
I have searched but cannot find a way to get this data correct. Any pointers would be much appreciated,
Sid.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The answer given by the expert was not a full solution and what I eventually implemented myself resolved the issue.
how do go generate / get
Open in new window
?They should look like:
Open in new window
This should then look identical to your CURL.HTH
Rainer