Solved

Strange Error with PDF and Download Redirect Script

Posted on 2007-04-04
4
300 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

740 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