If I post a html form like this:
<form action="htpp://url.com" method="post" />
<input type="hidden" name="name" value="John Doe" />
<input type="hidden" name="address" value="222 Main St" />
<input type="submit" />
it sends the data successfully.
But when I try to do this in vb:
I get an error (500 internal server error)
Am I doing this correctly?
thank you.
<form action="htpp://url.com" method="post" />
<input type="hidden" name="name" value="John Doe" />
<input type="hidden" name="address" value="222 Main St" />
<input type="submit" />
it sends the data successfully.
But when I try to do this in vb:
Code:
writer.Append("name=john doe&address=222Main St")
Dim webresponse As WebResponse = Nothing
Dim url As String = "http://url.com"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(writer.ToString)
req.ContentLength = byteArray.Length
Dim reqStream As Stream = req.GetRequestStream()
reqStream.Write(byteArray, 0, byteArray.Length)
reqStream.Close()
Am I doing this correctly?
thank you.
Comment