M
Michael
I have a IIS web site that works fine on one server but not another. I
do not know if the problem is an IIS setting or something else so I
will try to include as much detail as I have figured out so far.
Several web pages allow the user to download PDF files to be viewed or
saved locally on the user's machine, not in the browser. Those web
pages all redirect to a single ASP page with QueryString parameters
identifying the relative path to the desired file on a remote server.
The redirect URL would be something like:
download.asp?Src=Statements\2006\01\123456789
My download.asp code looks something like this:
=================================================
Dim strSourceName
Dim objDocServer
' Retrieve the path to the desired document
strSourceName = Request.QueryString("Src")
' Call remote COM+ application and retrieve document as binary stream
Set objDocServer = Server.CreateObject("DocumentServer.Application")
Set objDocServer.Document = objDocServer.getDocument(strSourceName)
With Response
.Buffer = True
.Clear
.ContentType = "application/pdf"
.AddHeader "content-disposition", "attachment; filename=test.pdf;"
.BinaryWrite(objDocServer.Document)
End With
=================================================
When I try to download a file, the browser shows the File Download
dialog asking me to Open or Save the file but it shows the File name as
"123456789" rather than "test.pdf". It also shows a blank value for the
File type. Whether I choose Open or Save the same error appears:
Internet Explorer cannot download 123456789 from <server>.
Internet Explorer was not able to open this site. The requested site is
either unavailable or cannot be found. Please try again later.
If I comment out the AddHeader line, the File type shows correctly as
Adobe Acrobat Document.
If I change the AddHeader to inline rather than attachment, I see the
binary data in the browser.
This exact code works fine on another server and I have no idea why it
will not work on this new server. What I find interesting is that the
download wants to name the file as 123456789 which comes from a part of
a QueryString value and nowhere else. Could this have something to do
with the "\" characters in the QueryString being confused as path
delimiters by IIS/ASP?
Any ideas or help are appreciated!
Michael
do not know if the problem is an IIS setting or something else so I
will try to include as much detail as I have figured out so far.
Several web pages allow the user to download PDF files to be viewed or
saved locally on the user's machine, not in the browser. Those web
pages all redirect to a single ASP page with QueryString parameters
identifying the relative path to the desired file on a remote server.
The redirect URL would be something like:
download.asp?Src=Statements\2006\01\123456789
My download.asp code looks something like this:
=================================================
Dim strSourceName
Dim objDocServer
' Retrieve the path to the desired document
strSourceName = Request.QueryString("Src")
' Call remote COM+ application and retrieve document as binary stream
Set objDocServer = Server.CreateObject("DocumentServer.Application")
Set objDocServer.Document = objDocServer.getDocument(strSourceName)
With Response
.Buffer = True
.Clear
.ContentType = "application/pdf"
.AddHeader "content-disposition", "attachment; filename=test.pdf;"
.BinaryWrite(objDocServer.Document)
End With
=================================================
When I try to download a file, the browser shows the File Download
dialog asking me to Open or Save the file but it shows the File name as
"123456789" rather than "test.pdf". It also shows a blank value for the
File type. Whether I choose Open or Save the same error appears:
Internet Explorer cannot download 123456789 from <server>.
Internet Explorer was not able to open this site. The requested site is
either unavailable or cannot be found. Please try again later.
If I comment out the AddHeader line, the File type shows correctly as
Adobe Acrobat Document.
If I change the AddHeader to inline rather than attachment, I see the
binary data in the browser.
This exact code works fine on another server and I have no idea why it
will not work on this new server. What I find interesting is that the
download wants to name the file as 123456789 which comes from a part of
a QueryString value and nowhere else. Could this have something to do
with the "\" characters in the QueryString being confused as path
delimiters by IIS/ASP?
Any ideas or help are appreciated!
Michael