This project is read-only.

MediaTypeFormatter for generic file downloader

Topics: ASP.NET Web API
Jul 24, 2014 at 11:44 PM
Is it possible for a MediaTypeFormatter to accept all media types?
Is it also possible to set the ContentType of the response based on the value that the action returns?

I am creating an action that allows users to download files.
If they don't specify an Accept header (or if it is /) I would like to return the file in its native format, and set its ContentType.

There is also the functionality to do some file type conversions (ie convert txt to pdf).
From what I've been reading, the MediaTypeFormatter seems to be the place to do these conversions.