aschepis
aschepis

Reputation: 764

ASP.NET MVC - Appending data onto a file download

what is the best way to append data onto a file download? I figure that i can make my own class that implements InputStream and just consolidates two input streams (the file first, my additional data to append second.) but is there an existing view class that i can use to just return an InputStream or will i have to roll my own view class as well?

Upvotes: 0

Views: 216

Answers (1)

Tigraine
Tigraine

Reputation: 23648

I think what you are looking for is a custom ActionResult class. I don't think you can get around writing your own ActionResult.

Phil Haack wrote about that here: http://haacked.com/archive/2008/05/10/writing-a-custom-file-download-action-result-for-asp.net-mvc.aspx

You just should not use HttpContext.TransmitFile but rather, write a byte array to the response.

Upvotes: 1

Related Questions