0

I am having a tough time understanding sending a multiPart message

The message that needs to be sent looks like the below. I do understand the message just do not know how to send it.

--5440585b006247a9a24fb4b81942c8c8\r\nContent-Disposition: form-data; name="key"\r\n\r\ne398f9e0-b9eb-11ed-97a9-b70a5ec88b1b\r\n--5440585b006247a9a24fb4b81942c8c8\r\nContent-Disposition: form-data; name="index"\r\n\r\n0\r\n--5440585b006247a9a24fb4b81942c8c8\r\nContent-Disposition: form-data; name="file"; filename="job.sbp"\r\nContent-Type: application/octet-stream\r\n\r\nmx, 10\nmx, 0\r\n--5440585b006247a9a24fb4b81942c8c8--\r\n

This is as far as I think I understand

       Dim MyIP As String = "http://" & "192.168.33.127"

        Dim request As HttpWebRequest = CType(WebRequest.Create(MyIP), HttpWebRequest)
        request.Method = "POST"
        request.KeepAlive = True
        Dim boundary As String = "--" & DateTime.Now.Ticks.ToString("x")
        request.ContentType = "multipart/form-data; boundary=" & boundary
  • Does this answer your question? [C# HttpClient 4.5 multipart/form-data upload](https://stackoverflow.com/questions/16416601/c-sharp-httpclient-4-5-multipart-form-data-upload) – Tu deschizi eu inchid Mar 03 '23 at 18:51
  • The following may be helpful: [article 1](https://code-maze.com/aspnetcore-multipart-form-data-in-httpclient/) and [article 2](https://brokul.dev/sending-files-and-additional-data-using-httpclient-in-net-core) – Tu deschizi eu inchid Mar 03 '23 at 18:52
  • Thank You this gets me a little closer. – user3786542 Mar 03 '23 at 23:57

0 Answers0