Hi Everyone,
I have a C# ASP.Net 1.1 web application that offers the feature to download the reports that we generate into a PDF file. When the Open/Save As dialog box appears, if you click the Save button, the PDF is saved successfully. However, if you click the Open button and you have the following system configuration:
Internet Explorer 6 with Win2000 or WinXP Operating System
You get the following error message in Adobe Reader: "There was an error opening this document. This file cannot be found." The following is the current code that I have been playing around. Basically it is a collection of all the items I found on forums put together.
Response.Clear();
Response.Cache.SetCacheability(HttpCacheability.Pr ivate);
Response.Expires = -1;
Response.Buffer = false;
Response.AddHeader("Pragma", "public");
Response.AddHeader("Expires", "0");
Response.AddHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0;");
Response.AddHeader("Cache-Control", "public");
Response.AddHeader("Content-Description", "File Transfer");
Response.AddHeader("Content-Type", "application/pdf");
Response.AppendHeader("content-disposition","attachment; filename=" + result + GlobalFunctions.GetDateFileName() + ".pdf");
Response.ContentType = "Application/pdf";
Response.WriteFile(rv.getFullPath);
Response.End();
For the record, the control "rv" is the Report Viewer control I created to interface with SQL Reporting Services. The filename and path that is created does not contain spaces. Any help with this matter would be greatly appreciated.
Thanks.