I am trying to send a web request but am getting the following error:
"System.IO.IOException: Cannot close stream until all bytes are written."
on the following line
Here is my code snippet
objRequest = CType(WebRequest.Create(post_url), HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentLength = 54
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.Headers("Authorization") = "BASIC " & authorization_string
post_string = "&command=requestnewpassword&application=netconnect"
' post data is sent as a stream
myWriter = Nothing
myWriter = New StreamWriter(objRequest.GetRequestStream())
Anyone have any ideas how to fix this?