multipart/form-data upload via SSL with compact framework

  • Thread starter Thread starter Toralf
  • Start date Start date
T

Toralf

Hello,
we have a problem with the multipart upload via https. Without a SSL
connection it works fine! The problem appears while writing in the
stream in line "str.Write(test, 0 , test.Length)". The errormessage is
"Ein Blockierungsvorgang wird momentan ausgeführt" it means in
English: A blocking opperation is currently excecuting. Errormessage
number: 10036

Oure code:

....
Dim str_boundary = "---xyz"
Dim url As String = "https://localhost/Upload.jsp"
Try
Dim test As Byte() = Encoding.ASCII.GetBytes(str_boundary + vbCrLf +
"content-disposition: form-data; name=" + Chr(34) + "File1" + Chr(34) +
"; filename=" + Chr(34) + "dateiname" + Chr(34) + vbCrLf +
"Content-Type: text/plain" + vbCrLf + vbCrLf + str_local_fileData +
str_boundary + vbCrLf)
Dim webReq As HttpWebRequest = CType(WebRequest.Create(url),
HttpWebRequest)
webReq.UserAgent = "TestUpload"
webReq.Method = "POST"
webReq.KeepAlive = True
webReq.ContentType = "multipart/form-data; boundary=" + str_boundary
webReq.ContentLength = test.Length
Dim str as Stream = httpWebRequest_global.GetRequestStream
str.Write(test, 0 , test.Length)
str.Close()
Dim res As HttpWebResponse = webReq.GetResponse
...
End Try
....
 
Back
Top