I need to send to Web Service a POST request with body that is represented as "multipart/form-data" Content-type.
The sample of the body is the following:
Content-Type:multipart/form-data; boundary=WebBoundary
--WebBoundary
Content-Disposition: form-data; name="Key#1"
Value#1
--WebBoundary
Content-Disposition: form-data; name="Key#2"
Value#2
--WebBoundary
Content-Disposition: form-data; name="FileKey"; filename="file.jpg"
Content-Type: image/png
--WebBoundary--
How can I construct MIME message for this use case using HttpWebRequest? I want also to customize data I send. For example at first I send 3 keys where 2 keys are strings and one is image, and other time I want to send 5 keys of image type. Anyway I didn't find in .NET library how to do it.
If anyone has a solution for this, I'll appreciate it.
Thank you in advance.