views:

46

answers:

1

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!

+2  A: 

Option 1: Use built in ActionResults, such as FilePathResult, FileStreamResult, FileContentResult (http://weblogs.asp.net/rajbk/archive/2010/05/03/actionresult-types-in-mvc2.aspx)

Option 2: Build a custom ActionResult to return your excel file (example: http://www.dotnetcurry.com/ShowArticle.aspx?ID=484&AspxAutoDetectCookieSupport=1)

Gmoliv
@Gmoliv: thanks a lot!
Lorenzo