ASP - Reponse.Redirect - To open a PDF file

sobee-rpg
sobee-rpg used Ask the Experts™
on
I have an asp page which takes the input and gets a PDF file and opens it.
I have used Response.redirect("http://temp/a.pdf") or Response.redirect("./temp/a.pdf")

Only in some systems it is getting opened directly.
in other systems it is not opening the pdf, just showing a blank page.

In those systems if delete the http in the addressbar and if press enter , then it is opening the PDF file

What will be the reason ?
How to make them open automatically in those systems.

Thanks
Sobee

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You could open empty HTML page and reset page content to your pdf file:

<body onload="window.document.location = 'http://temp/a.pdf'">

Author

Commented:
but my file name changes every time
how to put the file name which i get from the previous page on to the onload event of this page
Try using

Server.Transfer FileName

OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

<body onload="window.document.location = '<%=Request.Form("file_name")%>'">

Commented:
set a veriable first.

<%
dim myPDF
myPDF = request.querystring("filename")
myPDF="http://temp/" & myPDF

response.redirect myPDF
%>

if this doesn't help, post your code so I can get a better understanding of how you are doing this.

Author

Commented:
I tired with all these command.
In some system it is working . In some system it is giving a blank page

Im my ASP page I just get a file name of a particular pdf file and redirect to it's location.
Whether it is has some thing to do with IE version or OS ?

Thanks
Sobee


Commented:
Do all the PC's that you are trying this from have Adobe Acrobat reader installed?

Author

Commented:
Yes

Just now i went into acrobat site.
He says to change the preferences in Acrobat. By removing web browser integration.
If i do that i not getting the pdf opened in IE.

I tried this one in a machine which was already opening the page in IE
but after trying this (Changed back to prev preferences), that system too not opening the pdf now .
just showing a blank page

thanks
 sobee



Author

Commented:
Yes

Just now i went into acrobat site.
He says to change the preferences in Acrobat. By removing web browser integration.
If i do that i not getting the pdf opened in IE.

I tried this one in a machine which was already opening the page in IE
but after trying this (Changed back to prev preferences), that system too not opening the pdf now .
just showing a blank page

thanks
 sobee



Are you sure at least Acrobat Reader is installed on those other systems?

Author

Commented:
Yes it is installed in all the systems

thanks
sobee

Commented:
What systems, how are they connecting, what version of Acrobat, how big is the file?

If the file is big and takes a while to load, they'll see NOTHING until it's loaded (usually -- but not always, depends on the settings of the file). If you use a newer version of Acrobat and and they have an older one, the file may not load at all -- but Acrobat will be started anyway. If they didn't install the Reader correctly, or installed a new version and the plugin didn't install correctly, the Reader won't start.

They could also be getting the 'check for updates' prompt and not realize it -- that will pretty much stop everything, and the page won't load until they choose something.

Author

Commented:
No No

Actually when a page is redirected with the particular file
in the address bar it is coming as
http://temp/a.pdf
and showing an empty page

but when i delete that http: and press enter it is loading in acrobat reader.

as i have said earlier, if change the preferences of acrobat reader then the file is getting opened in acrobat and not in IE.
more over i can't go to every system and change the preference of acrobat reader.


Commented:
is TEMP the name of the web server and is a.pdf in the default web site?
Should it not be http://localhost/temp/a.pdf or are you just using TEMP instead of the correct URL?

Author

Commented:
Yes AgentASP u r right

i just gave an example .
it is actually
http://webserver/temp/a.pdf

You can use this method of redirect:

Response.Write ("<meta http-equiv='refresh' content='0;URL=http://temp/a.pdf") '>")      

This is a browserindepenant solution.

Hope this help.

WVDK                  
sobee-rpg,

Try setting your PDF link up as an object:
This will open Acrobat as a helper app.

HTML>
<HEAD>
</HEAD>
<OBJECT CLASSID="clsid:CA8A9780-280D-11CF-A24D-444553540000"
STYLE="height:100%; width: 100%" >
<PARAM NAME="src" VALUE="http://server/path/filename.pdf">
</OBJECT>
</HTML>

Here is a link that might help:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q293792

TurboDuster

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial