I just recently setup my site to use the CrystalReportViewer control offered in asp.net. I have worked through all of the setup and configuration issues, which was a good time. I am currently stuck trying to getting around IE 7 from blocking the file download when you try and print or export from the viewer control.
Crazy part is it works fine one my localhost when testing out of Visual Studio 05. I never get the download warning in IE 7. However, when I post it to the server I get the warning dropdown. I have dealt with this issue before when streaming files from the server to the client by using:
Response.AddHeader("content-disposition", "attachment;filename=Sales Report.xls") ' Set MIME type to Excel. Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" Response.Write(string or whatever goes here) Response.End()
I will say that all of my pages use AJAX, but I have removed all the ajax references from my test page. So this should not be an issue.
Test page code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AutoEventWireup="false" %> <%@ Register TagPrefix="CR" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Report Window</title> </head> <body> <form id="form1" runat="server"> <div> <CR:CrystalReportViewer ID="CrystalReportViewer1" Runat="server" AutoDataBind="True" Height="1158px" ReportSourceID="CrystalReportSource1" Width="1059px" GroupTreeImagesFolderUrl="" ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Style="z-index: 64; left: 0px; position: absolute; top: 0px" /> <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="EstActionList.rpt"> </Report> </CR:CrystalReportSource> </div> </form> </body> </html>
How can I prevent IE7 from giving my users a download warning? And I want to do this in code, not by changing the settings in IE7.