问题
Hello I am generating an excel file inside my action that I would return to the user. How do I have to declare the action to return a file?
May I call this action with ajax?
thanks!
回答1:
Option 1: Use built in ActionResults, such as FilePathResult, FileStreamResult, FileContentResult
Option 2: Build a custom ActionResult to return your excel file (example: http://www.dotnetcurry.com/ShowArticle.aspx?ID=484&AspxAutoDetectCookieSupport=1)
来源:https://stackoverflow.com/questions/3935225/asp-net-mvc-how-to-make-an-action-that-return-a-file