response.redirect to a PDF

jenn5175
05-23-2002, 01:06 PM
Hi all, anyone know why I would not be able to response.redirect to a PDF file? According to sites found on Google and Yahoo this should work - it should just launch Adobe Reader and open my file. However, it does not. When you run the redirect page the first time it launches Adobe Reader's opening screen, then says "This file is corrupted and cannot be opened". However, when you just type the URL to the PDF it opens fine. Every time after you run the redirect script it just puts a blank screen up on your browser and the status bar says "Done" - no Adobe Reader tool bar so the program has not launched. We have tested on various browsers/computers and it responds the same everytime. Any ideas? I found some literature on Server.Transfer as an alternative but when run I get "Object doesn't support this property or method: 'Server.Transfer' " so the IIS running this script (it's for a client hosted externally) obviously is not IIS 5 or higher. What else can I try? Any help would be much appreciated!!!

Jenn

Rezner
05-23-2002, 02:37 PM
Well...response.redirect "yourpage.pdf"...should work.

I just tested it on IIS and it worked fine for me. The .pdf doc is used like any other url, so no object library is needed. I would try to update both your browser and your Acrobat version. :confused:

jenn5175
05-23-2002, 02:43 PM
I just downloaded Reader a few weeks ago when I began this project so I have the most current version. I found a workaround in case anyone else has this issue. I redirected to an HTML page with javascript in the body tag(onLoad="document.location.href='page.pdf'") and it worked. But I am still very curious as to why my original way did not work. If anyone has any explanations/theories I am interested to hear them.

The only thing I can come up with is that when the client made these specific PDFs somehow they screwed up some sort of header (do PDFs use headers?) - which doesn't explain why going to it directly through the URL works every time........

Jenn

Rezner
05-23-2002, 02:53 PM
Well, try this pdf. I know that it works:response.redirect "http://www.nelson-atkins.org/AnnualReport2000-2001.pdf"

jenn5175
05-23-2002, 03:00 PM
Again it says (here's the exact error message in the popup): "File is damaged and could not be repaired"...hmm....so this worked for you in a response.redirect? I have tried it with both I.E. 6 and Netscape 4 and Acrobat Read 5.0 (running Windows 2000). It does it on both my machine and my client's so it's not just that I corrupted my Reader somehow. Try this link on you rmachine: http://www.thepixelbox.com/uscarEmail/grabemail.asp?iDocumentID=1 and let me know if you can see your PDF you just posted the link to....

Robby
05-23-2002, 03:11 PM
Your code to pull up the PDF is working fine.

I think it's the PDF itself.

Try and create a new one.(PDF)

jenn5175
05-23-2002, 03:21 PM
Well, I have found it is not the PDF because Rezner gave me a link to a PDF I had never tried before. Again, my machine pulled it up fine when typed directly into the URL but was "Damaged" when gotten through a response.redirect. So it does not matter what PDF is redirected to (I have tried roughly 8 different ones now). Something in the response.redirect is not giving Adobe Reader all it needs to open the file. Yes the page is being redirected there correctly, but Reader can't read the file returned by server via the redirect.

Can anyone else actually get to the PDF via the page linked to above? (http://www.thepixelbox.com/uscarEmail/grabemail.asp?iDocumentID=1) - just trying to determine if my client and I both have some sort of weird corruption going on and the rest of the world can see it.

Also, I have tried it on our test server, web server and the client's hosting provider's server, so I doubt it's something at the server level messing up since these machines are not related. I am now on a mission to figure this out! :)

Jenn

Robby
05-23-2002, 03:38 PM
Instead of a Redirect, have you tried as a regular <a href..... ?

jenn5175
05-23-2002, 03:41 PM
Looks like <a href...> works fine.....

Rezner
05-23-2002, 04:28 PM
I just tried that PDF you supplied and it worked fine for me in a response.redirect

jenn5175
05-24-2002, 07:28 AM
So it worked when you coded it yourself on your server? Or when you went through my link above? If it worked on your server, what version of IIS are you running? Or ARE you running IIS? My test and web servers are running NT with the IIS that comes with NT 4.0 Option Pack. Maybe you're running 2000 or XP??? My client's hosting provider must be running a similar setup to mine. I think it has to be attributed to server versions - maybe IIS from NT 4.0 OP just doesn't return everything it is supposed to ..... ? So confused......Thanks for trying to help, though! I really appreciate it - this is driving me nuts!!! :eek:

Jenn

Thinker
05-24-2002, 08:10 AM
What Service Pack level is your NT server up too?

Rezner
05-24-2002, 11:52 AM
Originally posted by jenn5175
So it worked when you coded it yourself on your server? Or when you went through my link above?

I coded it into an .asp page and tested it. I'm not sure what SP is installed on this IIS (at work here)... but it's most likely the latest.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum