I am constructing a MIME multipart stream that is a collection of various files/data the user has chosen for upload. I then PUT this stream to a URL using asp.net MVC 3 (though the MVC bit should be irrelevant to the question - similar applies to all ASP.NET), where it comes in on the server as a HttpFileCollectionBase object (which is itself basically a collection of HttpPostedFileBase objects).
This all works fine.
However, the HttpPostedFileBase only allows access to the MIME 'media type' and 'filename' fields. I have other data which I am putting in the
Content-Description:
and
Content-Disposition:
headers in the MIME multipart - but there seems to be no way to access these at the server end. Obviously I realise that media type and filename are the most common fields used and hence I have no problems with having to jump through some hoops to get some of the more esoteric MIME fields. However, I can't see any way to access them at all. Do I need to hook in my own MIME multipart decoding engine into the ASP.NET/MVC framework? If so, where are the hooks, and are there libraries out there that do this without me having to write a MIME decoder.
You can access the raw request body data using the Request.InputStream property. And to access the request HTTP headers you could use the Request.Headers property.