开发者

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 c开发者_开发百科lass 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜