When I return a FilePathResult from an MVC action method, which of the following happens (assuming, if it matters, that the file to which the result points is very large):
If the answer is 1, is it possible to have the file sent as in 2 instead by returning a different type of result?
UPDATE: FilePathResult uses response.TransmitFile which "Writes the specified file directly to an HTTP response output stream, without buffering it in memory.". Here's the source code for MVC.
You can stream data back using the FileStreamResult class:
return new FileStreamResult(stream, "application/pdf")
{
result.FileDownloadName = "somefile.pdf";
};
Or you could redirect to the file like this:
return Redirect("somefile.pdf");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With