在我的应用程序中,我将一些文件保存在服务器上,并在某些业务逻辑上使它们可供下载。
正在下载所有其他文件类型,但 .msg(Outlook message)
文件未下载并给出错误:
404 - File or directory not found. The resource you are looking for might
have been removed, had its name changed, or is temporarily unavailable.
图像、.docx、.txt 所有其他文件都运行良好。
该页面是在 ASP.NET 中设计的,并且在标记之后出现在客户端站点。
最佳答案
发现于 ASP.NET forum .
创建处理程序,将其下载为文件:
Response.ContentType = "application/vnd.ms-outlook";
Response.AppendHeader("Content-Disposition","attachment; filename=Message.msg");
Response.TransmitFile(Server.MapPath(YourPathToMsgFile));
Response.End();
或更改 IIS 6.0 中的设置:
Select HTTP Header -> click MIME types - > Click New and add ".msg" as extension and "application/vnd.ms-outlook" as MIME type.
关于c# - .msg 文件给出下载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9718003/