?
Solved

Strange Error with PDF and Download Redirect Script

Posted on 2007-04-04
4
Medium Priority
?
305 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…
Suggested Courses

762 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