PRB: Excel and Word Content Do Not Stream as Expected from ASP .NET (318756)
The information in this article applies to:
- Microsoft Office Excel 2003
- Microsoft Excel 2002
- Microsoft Excel 2000
- Microsoft ASP.NET (included with the .NET Framework) 1.0
- Microsoft Office Word 2003
- Microsoft Word 2002
- Microsoft Word 2000
- Microsoft Internet Explorer (Programming) 6.0
- Microsoft Internet Explorer (Programming) 5.5
This article was previously published under Q318756 SYMPTOMS When you download Web content for a Multipurpose Internet
Mail Extensions (MIME) content type that is associated with a Microsoft Office
application, Internet Explorer displays a dialog box that prompts you to either
open the file, or to save the file to disk. If the content is streamed from an
ASP.NET Web application, the Open button of the dialog box is disabled. The same content streamed
from an ASP page works as expected. CAUSE The client computer has version 6.0.2713.1500 (or later) of
Shdocvw.dll installed. Version 6.0.2713.1500 of Shdocvw.dll is included in the
Internet Explorer cumulative patch from Microsoft Security Bulletin
MS02-005. When you add a Content-Type header to an HTTP response by
using the ContentType property or the AddHeader method in ASP.NET, ASP.NET will append a character set to the
Content-Type string. A example of the response that the client application
receives is as follows:
Content-Type: application/vnd.ms-excel; charset=utf-8
When Internet Explorer receives this Content-Type header, Internet
Explorer searches the HKEY_CLASSES_ROOT\MIME\Database\Content Type key in the registry to locate the associated extension. Internet
Explorer uses the extension to determine if the Open button should be enabled. When the character set is included in
the Content-Type string, this MIME type is not found in the registry, and
because Internet Explorer cannot determine the extension for the MIME type, it
disables the Open button. This behavior is a result of the security patch for
MS02-005. By default, the character set string is not added in an ASP
Page. The character set string is only added to an ASP.NET (.aspx) Web page.
RESOLUTION To resolve this problem, remove the charset attribute from the Content-Type string. To do this in ASP.NET,
set the Charset property to an empty string as follows:
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
NOTE: Client computers that have the Browse in same window feature turned off do not receive the dialog box, and the server
displays the file without the prompt. STATUSThis
behavior is by design.REFERENCES
For additional information about the Browse in Same Window
option, click the following article number to view the article in the Microsoft Knowledge Base:
162059
Office Documents Open in Internet Explorer
For additional information about the security patch, click the following article number to view the article in the Microsoft Knowledge Base:
316059
MS02-005: 11-Feb-2002 Cumulative
Patch for Internet Explorer
Modification Type: | Major | Last Reviewed: | 3/23/2006 |
---|
Keywords: | kbprb KB318756 |
---|
|