编程语言
首页 > 编程语言> > c# – 使用safari浏览器发布下载文件

c# – 使用safari浏览器发布下载文件

作者:互联网

我正在开发一个Web应用程序,其中一些.docx,.xlsx需要从Web应用程序下载,应用程序在所有顶级浏览器中按预期工作,除了safari,当我尝试下载带有safari的文件时我得到下载.aspx页面而不是.docx文件,¿我该如何解决这个问题?,这是文件下载的实现代码,在此先感谢您的帮助.

 Response.ClearContent();
 Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
 Response.AppendHeader("Content-Disposition", "attachment; filename=PruebaSharePoint.docx");
    Response.TransmitFile("~/PruebaSharePoint.docx");
    Response.Flush();
    Response.Close();

解决方法:

我有同样的问题,它通过替换它解决了:

response.setContentType("application/ms-excel");

有了这个:

response.setHeader("Content-Type","application/ms-excel"); 

标签:c,net,web-applications,asp-net,sharepoint-2010
来源: https://codeday.me/bug/20190704/1373341.html