We have a CMS I created and it’s working great but now I want to move the download of the mobile binary (installer) files to the CMS. They are currently streamed from another server.
The only solution I can see is to have an index of what files are in what folders etc as an Xml document and use Linq2Xml for retrieving the files and streaming them to the mobile browser. I really don’t want to use a database for this. I was thinking of upgrading the download portals to MVC because of the built in capabilities to stream a file directly to a browser by specifying byte[], filename and mime.
Any better suggestions?
Very simple to provide files directly from an MVC controller. Here’s one I prepared earlier, as it were:
You might need to do a bit more work actually deciding what file to deliver (or, more likely, do something completely different), but I’ve just cut it down to the basics as an example that shows the interesting return bit.
DownloadResult is a customised ActionResult: