Wednesday, 11 September 2013

How to download a file from an ajax call to a controller?

How to download a file from an ajax call to a controller?

I am making a GET ajax call to an mvc controller that returns a
FileStreamResult. Now when I look at the network traffic of the browser, I
see a XMLHttpRequest being made which comes back with a 200 result.
In ie f12 tool if I go to the response body tab I see a Save as link,
which when clicked gives the correct file

How do I instead give them an option to download the file?

No comments:

Post a Comment