Solved

Strange Error with PDF and Download Redirect Script

Posted on 2007-04-04
4
301 Views
Last Modified: 2013-11-19
Hi,

I've got some trouble on my download redirect script. On some places it works fine but on other workstations I get an error.

Ok, here is what the script does (C#):
Response.Clear();
Response.Buffer = true;
Response.Expires = 0;
Response.AddHeader("Content-Disposition", strDisposition + " ;filename=" + Server.UrlEncode(strFileName + "." + strFileExt));
Response.ContentType = strMimeType;
Response.WriteFile(objFile.FullName);
Response.Flush();
Response.End();

Where:
- strDisposition is either "inline" or "attachment", but in the case of my PDF files it is "attachment" to force the user to download the file instead of opening the PDF with the Browser Plug-In.
- strFileName is the filename with all special characters removed and strFileExt is the extension of the file (.pdf)
- strMimeType is the ContentType of the document, in my problem case: "application/pdf"
- objFile.FullName is the full absolut physical path on the server (which has the right permissions to be accessed)

Well as I already mentioned, on some workstation it works, I don't think it is an Acrobat problem (it is working with Acrobat 7 and 8), it is working on some workstations with IE6 and IE7. But actually in Firefox it is working all the time (no problems). The file is being downloaded, but when we open it with the default application (Acrobat) we get an error telling us that there has been an error while opening the document, the file could not be found.
A workaround is to save the file to the desktop (or somewhere else) and then opening it with a double click.

I really can't figure out where the problem is ... does anybody has a clue?
0
Comment
Question by:SiraX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:SiraX
ID: 18848968
Here are some more information related to the problem - (not) working combinations:
IE: Internet Explorer, AR: Acrobat Reader, AP: Acrobat Professional
1. Windows XP (corp network), IE6, AP7 -> not working
2. Windows XP (corp network), IE6, AR7 -> not working
3. Windows XP (corp network), IE6, AR7 -> not working
4. Server 2003 Std, IE7 (corp network), AR5 -> working
5. Windows XP (corp network), IE7, AR8 -> working
6. Windows Vista (home), IE7, AR8 -> working

And as already said, with Firefox it is working all the time ...

Another hint, I found right now in forums and newsgroups (actually PHP related) that IE6 with Acrobat seems to have problems with the cache ... and I have implemented an OutputCache in my download redirect script. Can someone confirm this as the error?
0
 
LVL 19

Accepted Solution

by:
DreamMaster earned 500 total points
ID: 18848991
Things I have found could cause similar problems:

- Acrobat Reader was installed but for some reason the web part of it doesn't work properly. It can never open a document in the browser in other words..

- Caching will sometimes destroy your ability to open a pdf file in the browser, like you said it is a known problem, but one that is hard to reproduce

Hope it helps.
Regards,
Max.
0
 

Author Comment

by:SiraX
ID: 18849046
Hi there,
Ok, I found the problem now ... I could reproduce the problem on a testing machine with IE6, after upgrading to IE7 it worked fine.

The problem was indeed the OutputCache in combination with Internet Explorer 6! So if other people have the same problem, think about removing caching options.

Best regards,
David
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18849079
Glad to have been helpful :)

Regards,
Max.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exchange OWA website Redirection 7 77
Textbox autocomplete using jquery in asp.net 13 44
How do I "share" on social sites? 2 33
regular gmail; not g-suite. one label. 11 44
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question