我有以下代码,部署在HTTPS Asp位点,建立与MVC 4.0:Internet Explorer错误
public FileResult ANotSoWorkingFunction(string filePath, string fileName)
{
pathToFile = string.Format("~/{0}/{1}", pathToFile, fileName);
return File(new FileStream(pathToFile, FileMode.Open), "application/pdf", fileName);
}
这将工作(如你许多你可能已经猜到)与Chrome,Firefox和IE9。但它会抛出:
---------------------------
Windows Internet Explorer
---------------------------
Internet Explorer cannot download someFileName from a_site.com.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
---------------------------
OK
---------------------------
在IE6,7,8
在这一个任何想法或线索是极大的赞赏,因为我已经花洞一天HTML头打。
编辑:
下面是IE7头:
HTTP/1.1 200 OK
Cache-Control: private, no-cache="Set-Cookie"
Content-Type: application/pdf
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
Set-Cookie: .ASPXAUTH=; expires=Mon, 11-Oct-1999 21:00:00 GMT; path=/; HttpOnly
X-Powered-By: ASP.NET
Date: Wed, 04 Apr 2012 08:43:50 GMT
Content-Length: 233324
这里是那些从IE9:
HTTP/1.1 200 OK
Cache-Control: private, no-cache="Set-Cookie"
Content-Type: application/pdf
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
Set-Cookie: .ASPXAUTH=; expires=Mon, 11-Oct-1999 21:00:00 GMT; path=/; HttpOnly
X-Powered-By: ASP.NET
Date: Wed, 04 Apr 2012 08:42:14 GMT
Content-Length: 233324
谢谢
你能告诉我们你的“Cache-Control”和“Set-Cookie”响应头吗? – Levi 2012-04-03 21:27:08
当然可以Lezi,谢谢你在这个 – Calin 2012-04-04 08:49:34
intress可能是在mvc 3相同的问题 http://stackoverflow.com/questions/6943443/asp-mvc3-fileresult-with-accents-ie8-bugged – 2012-04-19 15:01:24