I did several searches on the net to find a way for me to generate a spreadsheet and save to disk.
As it comes to the web, this can only be done via download, and all examples searched (at least for me), I fall into FileResult . Turns out it's not working.
I took a simple example and it gives the same error. See the code
public FileResult Download()
{
byte[] fileBytes = System.IO.File.ReadAllBytes(@"c:\folder\myfile.ext");
string fileName = "myfile.ext";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
In this line I get the error
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
This is the error:
Non-invocable member 'File' can not be used like method.
How do I resolve this error?