Reputation: 5004
I am currently building my project locally using MVC.
The user enters some search information and is presented with a link to download a file in Vox format that exists somewhere else on the network.
That other server has a shared drive with authentication.
I need to have my controller grab that file and spit it out to the client for download.
What is the best approach?
Thanks!
Upvotes: 0
Views: 266
Reputation: 1038990
What is the best approach?
By exposing a controller action that returns a FileResult
:
public ActionResult Download()
{
byte[] file = ... go and fetch the file contents from wherever it is stored
return File(file, "some MIME type", "filename.someextension");
}
and then inside your view provide a link to the user so that he can download:
@Html.ActionLink("download the Vox file", "Download")
Upvotes: 1