English 中文(简体)
IE8能够下载pdf文档
原标题:IE8 can t download pdf file

我有MVC申请,归还PDF档案。

 public FileStreamResult GetDocument(int id)
 {
   return File(stream, "application/octet-stream", documentsModel.Name);
 }

我有两个测试服务器。 一种是私人的,另一种是公开的。

我可以下载文件。

GET /Documents/GetDocument/3576 HTTP/1.1
Accept: */*
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/2)
Accept-Encoding: gzip, deflate
Host: appserver
Connection: Keep-Alive
Cookie: ASP.NET_SessionId=vgzn4qkelxdmic3nbaqftsxd; .FidesAuthCookie=BF08E0DCAAA54D7D78AB6BD30D5ECA523C045F9B401B10693B6CE57D7D4C677C0908E24D92511DC75A487D6CAE6DD780AA8B4419A5A5D9258A4985AF6870D3AD1A0B3C01B8A620A1E14FEDDE298CCE255AE4B4C2F76D2635B8C5DF332AF19AAB; dynatree-active=3576; dynatree-focus=; dynatree-expand=496%2C603%2Cfolder_622; dynatree-select=


HTTP/1.1 200 OK
**Cache-Control: private, s-maxage=0**
Content-Type: application/octet-stream
Server: Microsoft-IIS/7.5
Set-Cookie: .FidesAuthCookie=BF08E0DCAAA54D7D78AB6BD30D5ECA523C045F9B401B10693B6CE57D7D4C677C0908E24D92511DC75A487D6CAE6DD780AA8B4419A5A5D9258A4985AF6870D3AD1A0B3C01B8A620A1E14FEDDE298CCE255AE4B4C2F76D2635B8C5DF332AF19AAB; expires=Fri, 13-Apr-2012 13:31:05 GMT; path=/
X-AspNetMvc-Version: 3.0
Content-Disposition: attachment; filename=test.pdf
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 13 Apr 2012 13:01:04 GMT
Content-Length: 49613

我从我的公共服务器获得服务。

GET /Documents/GetDocument/97 HTTP/1.1
Accept: */*
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/2)
Accept-Encoding: gzip, deflate
Host: beta.qi-care.nl
Connection: Keep-Alive
Cookie: ASP.NET_SessionId=h3utp0bfu4zwhqysntame3we; dynatree-active=97; dynatree-focus=; dynatree-expand=4%2Cfolder_10; dynatree-select=; .FidesAuthCookie=F0DED3D98BF4115C910B0A29EC2C809902B49F15518952DFA78DDB4358B5F0C1A9EDAFB50DD0CA761B433ED68034C2539ABCCDA0C50FF5EEEE3573D3C77E550416CDB24B302C9EB831AC597040E6D255E9B582E8A29D5FC03454F2A0742ECC9DEC61070091F9A66D1C3FC7F9CA10C1B8BB9B5109CB613C98AEE32AFE5A0F8A28



HTTP/1.1 200 OK
**Cache-Control: private, no-cache="Set-Cookie", s-maxage=0**
Content-Type: application/octet-stream
Server: Microsoft-IIS/7.5
Set-Cookie: .FidesAuthCookie=F0DED3D98BF4115C910B0A29EC2C809902B49F15518952DFA78DDB4358B5F0C1A9EDAFB50DD0CA761B433ED68034C2539ABCCDA0C50FF5EEEE3573D3C77E550416CDB24B302C9EB831AC597040E6D255E9B582E8A29D5FC03454F2A0742ECC9DEC61070091F9A66D1C3FC7F9CA10C1B8BB9B5109CB613C98AEE32AFE5A0F8A28; expires=Fri, 13-Apr-2012 13:19:35 GMT; path=/
X-AspNetMvc-Version: 3.0
Content-Disposition: attachment; filename=test.pdf
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 13 Apr 2012 12:49:35 GMT
Content-Length: 49613

我错了。

http://support.microsoft.com/kb/323308

出于某种原因,我从这两个服务器收到了两个不同的答复。 但我在微软公司的支持下发现,客户应当改变登记处。

To resolve this issue in Internet Explorer 7 and in Internet Explorer 8, follow these steps:
Start Registry Editor.
 For a per-user setting, locate the following registry key:
    HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionInternet Settings
 For a per-computer setting, locate the following registry key:
    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet Settings
 On the Edit menu, click Add Value.
 To override the directive for HTTPS connections, add the following registry value:
    "BypassSSLNoCacheCheck"=Dword:00000001
 To override the directive for HTTP connections, add the following registry value:
    "BypassHTTPNoCacheCheck"=Dword:00000001
 Quit Registry Editor.

http://support.microsoft.com/kb/323308”rel=“nofollow noreferer”>Microsoft

问题回答

我们在工作时面临这一问题,被证明是因特网探索者(就IE8-而言)的诱骗,这在试图下载SSL(你在https上,正确?)的档案时造成了错误。 问题是,如果服务器向浏览器发送一台可拆解的头盔,探索者就会发现错误。 在您的情形下,maxage=0相当于。 Cache-Control: no cache .

The solution server side is that you should overwrite this header to tell IE8 to cache the response, with Cache-Control: private for example. Be careful that some application servers (such as in our case Websphere Application Server) append automatically no-cache="Set-Cookie" when a cookie is set.

最后,如果适用,还有另一种解决办法可以解决这个问题,但应在浏览器上适用客户方:

look at Method 1: http://support.microsoft.com/kb/2549423





相关问题
How to suppress/remove PHP session cookie

I need to suppress an already set session cookie header, but I cannot find any way to do this. Why? I need to make an image, sent by a PHP script, cacheable by the end user; this image is used to ...

Why is my page still executing?

I have a form that posts to a processing script which checks for errors in the post. Depending on the processing it header redirects to another location. This appeared to work but I have just noticed ...

How to stop floating (sliding) div at footer

How can I have a sliding menu div that doesn t move unless the page is scrolled down past a certain point I used the code from this link for a floating menu. it has how to stop the stop float at ...

Better way to share header file between separate vc project?

How would you organize your vc projects source code to share the same header file? put the header in a common folder, and have every vc projects include it. put the header in a vc project, and have ...

how to tell clicking "back" to load cache?

I would like for my site when someone clicks "Back" or "Forward" for the server to tell the browser to load the cache instead of reloading the entire page. I ve tested some headers and done research, ...

热门标签