I am trying to return a byte array from my MVC project controller to an html view. So far I haven't had any luck with trying to use FileStreamResult
, due to Type System.Web.Mvc.FileStreamResult
cannot be serialized. How can I return the byte array from my Controller
to a View
so that I can download a file?
Asked
Active
Viewed 860 times
0

Ivan Sivak
- 7,178
- 3
- 36
- 42

user3780986
- 53
- 1
- 2
- 7
-
possible duplicate of [Returning a file to View/Download in MVC](http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-mvc) – Erik Philips Jul 24 '14 at 16:17
-
Try this: [HttpGet] public FilePathResult DownloadTemplate() { return this.File(Path.Combine(this.excelTemplateFolder, this.excelTemplateFileName), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); } – Bhasyakarulu Kottakota Jul 24 '14 at 16:22