【发布时间】:2020-03-26 09:38:33
【问题描述】:
我正在尝试通过 ActionResult 返回文件内容。但是,我找不到 File() 函数属于哪个库。所以 File(..) 无效。文件属于哪个库?我需要添加它。它属于 system.web.mvc 吗?但我在 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();
}
}
【问题讨论】:
标签: c# asp.net file actionresult