I am trying to return a file content via the ActionResult. However, I cannot find which library the File() functions belong to. So the File(..) is not valid. Which library does the File belong to ? I need to add it. Is it belong to system.web.mvc? but I cannot find File in System.Web.Mvc.
[HttpGet]
public virtual ActionResult Download(string fileGuid,string fileName)
{
Guid guid = new Guid(fileGuid);
if (store[guid].Ready != 0)
{
byte[] data = store[guid].Data as byte[];
// The File here is not valid, I can't find which library it belong to
return File(data, "application/vnd.ms-excel",fileName);
}
else
{
return new EmptyResult();
}
}
This may depend on the exact target framework, but: there are a range of public virtual FileContentResult File(...)
overloads on Microsoft.AspNetCore.Mvc.ControllerBase
which should be available if your controller inherits from that. Alternatively, you can use new FileContentResult(...)
directly, from Microsoft.AspNetCore.Mvc
- all in Microsoft.AspNetCore.Mvc.Core.dll
.