I have the following site http://localhost/abc.htm which requires authorization
<form method="POST" action="/change">
<input type="hidden" name="node" value="12 4A 72 1" /><table>
<tr>
<td>
<input type="submit" name="submit" value="On" />
</td>
<td>
<input type="submit" name="submit" value="Off" />
</td>
</tr>
</table>
</form>
I'm trying to programatically post to this form as if I pressed the submit button "on". So far I've been able to authenticate and download the page using the WebClient class.
Dim myCache As New CredentialCache()
Dim req As New WebClient()
Dim results As String
myCache.Add(New Uri(URL), "Basic", New NetworkCredential(UserName, Password))
req.Credentials = myCache
results = UTF8.GetString(req.DownloadData(URL))
Now I'm trying to simulate pressing the button using UploadValues
Dim mvc As New NameValueCollection
mvc.Add("node", "12 4A 72 1")
mvc.Add("submit", "On")
req.UploadValues(URL, mvc)
However on the last line, I'm getting "The request was aborted: The request was canceled".
Any ideas as to what I'm doing wrong? Am I even using the correct set of classes for what I'm trying to accomplish?