2012-04-13 13 views
1

私はPDFファイルを返すMVCアプリケーションを持っています。IE8はPDFファイルをダウンロードできません

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

私は2つのテストサーバーを持っています。 1つは非公開で、もう1つは公開です。

民間から私は、ドキュメントをダウンロードすることができますし、私が取得:

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

を取得私はこれらの2つのサーバーから、2つの異なる応答を持っています。しかし、私は、クライアントがレジストリに

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_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings 
For a per-computer setting, locate the following registry key: 
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet 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. 

Microsoft

答えて

0

を変更する必要があることを我々は仕事でこの問題に直面し、それは(我々の場合IE8-で)Internet Explorerのバグであることが判明し、それが与えるMicrosoftサポートで発見しましたSSLでファイルをダウンロードしようとしたときにエラーが発生しました(あなたはhttpsにいますか?)。問題は、サーバーがキャッシュを無効にするhttpヘッダーをブラウザーに送信した場合、Explorerはエラーを出します。あなたの場合、maxage=0Cache-Control: no cacheに相当します。

解決策のサーバー側では、たとえば、Cache-Control: privateと応答をキャッシュするようにIE8に指示するために、このヘッダーを上書きする必要があります。 クッキーが設定されている場合、一部のアプリケーションサーバー(Websphere Application Serverなど)によって自動的にno-cache="Set-Cookie"が追加されることに注意してください。

最後に、そこに問題を解決し、別の解決策、適用可能な場合は、ですが、それは、ブラウザ上で、クライアント側に適用されるべきである:方法1で

外観: http://support.microsoft.com/kb/2549423

関連する問題