【发布时间】:2016-09-28 08:08:50
【问题描述】:
我正在向浏览器发送文件以保存在本地。这适用于除 Microsoft Edge 之外的所有浏览器,它用 guid 替换文件名。该文件必须使用特定文件名下载,是否有此问题的解释或解决方法?我的回答“不要使用 Edge”将被拒绝。
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ByteArrayContent(CreateFile(fileContents))
};
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = string.Concat(fileName, ".xlsx")
};
【问题讨论】:
-
这似乎是 Edge 中长期存在的错误,目前尚未修复:developer.microsoft.com/en-us/microsoft-edge/platform/issues/…
标签: c# microsoft-edge httpresponsemessage