Solved

Strange Error with PDF and Download Redirect Script

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever come up with a need of emailing only few pages of PDF file to one of yourfriend or colleague, instead of whole Adobe file? If yes, then surely you have face problems in doing that! Read this section as I have suggested multiple solutio…
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…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now