Adobe PDF and IE caching problem ASP.Net C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spoonybard
    New Member
    • Nov 2007
    • 19

    Adobe PDF and IE caching problem ASP.Net C#

    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 (HttpCacheabili ty.Private);
    Response.Expire s = -1;
    Response.Buffer = false;
    Response.AddHea der("Pragma", "public");
    Response.AddHea der("Expires", "0");
    Response.AddHea der("Cache-Control","must-revalidate, post-check=0, pre-check=0;");
    Response.AddHea der("Cache-Control", "public");
    Response.AddHea der("Content-Description", "File Transfer");
    Response.AddHea der("Content-Type", "applicatio n/pdf");
    Response.Append Header("content-disposition","a ttachment; filename=" + result + GlobalFunctions .GetDateFileNam e() + ".pdf");
    Response.Conten tType = "Applicatio n/pdf";
    Response.WriteF ile(rv.getFullP ath);
    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.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    I don't believe that this is a caching problem. Either you can't open the document unless it is saved first or it may be a postback problem.

    Comment

    Working...