I'm using this code to return a FileContentResult with an msi file for the user to download in my ASP.Net MVC controller:
using (StreamReader reader = new StreamReader(@"c:\WixTest.msi"))
{
Byte[] bytes = Encoding.ASCII.GetBytes(reader.ReadToEnd());
return File(bytes, "text/plain", "download.msi");
}
I can download the file, ...
Is there a way to stream a file using ASP.NET MVC FileContentResult within the browser with a specific name?
I have noticed that you can either have a FileDialog (Open/Save) or you can stream the file in a browser window, but then it will use the ActionName when you try to save the file.
I have the following scenario:
byte[] contents ...
We are using it to return a file for an export. When we run this export on a lot of records, it takes close to 10 minutes to run. Here is a code snippet of the code that actually calls the File() method and returns the result.
Public Function Export(ByVal ID As Integer) As FileContentResult
Dim str As String = String.Empty
Dim data(...