How to submit a multipart/form-data HTTP POST request from C#

.net, c#, http, multipartform-data, post

Solution

First of all, there's nothing wrong with pure manual implementation of the HTTP commands using the .Net framework. Do keep in mind that it's a framework, and it is supposed to be pretty generic.

Secondly, I think you can try searching for a browser implementation in .Net. I saw this one, perhaps it covers the issue you asked about. Or you can just search for "C# http put get post request". One of the results leads to a non-free library that may be helpful (Chilkat Http)

If you happen to write your own framework of HTTP commands on top of .Net - I think we can all enjoy it if you share it :-)

Problem

What is the easiest way to submit an HTTP POST request with a multipart/form-data content type from C#? There has to be a better way than building my own request. The reason I'm asking is to upload photos to Flickr using this api: http://www.flickr.com/services/api/upload.api.html

Original source

Related problems