1

I am building a website in MVC. At the moment i need to return to a view and download a file.

This return downloads the file:

return "http://formvalue.co.za/download/" + filename + ".xlsx"; 

And this return will direct me to my view:

return "Complete";

The views name is complete.

I can only have one return but i need both actions preformed?

Is there some way to do them both in one return?

Please if you need more info just ask, Thanks in advance.

Pomster
  • 14,567
  • 55
  • 128
  • 204

1 Answers1

-1

Do you really need to track whether the file was downloaded or not? Personally, I would re-direct the user to a "Thank you for downloading" page rather than a "Complete" page and trigger the download via an AJAX request. The user will already get a "Download Complete" notification via the browser so you probably don't need to do one yourself.

Here is an example of how to download a file using MVC.

Community
  • 1
  • 1
James
  • 80,725
  • 18
  • 167
  • 237