J
Jim Willis
Hi,
I have an application that returns a PDF document to the browser (not as a
download). The document is returned in a new window. This works fine in
most installations, but I have one installation where it doesn't work in IE,
but does work in Netscape. At the installation where it doesn't work IE
returns the file download dialog box instead of just opening the file. When
I click open or save it complains that it can't find the file. I suspect
the problem is with the file name. IE is generating a very long file and
I'm guessing it is getting confused. My code did not originally set the
file name, so I'm trying to solve the problem by setting the file name.
Here's the code that I'm using, but it doesn't seem to have any affect.
Does anyone see why this doesn't work? objHttpConn is an HTTP control that
is used to retrieve the PDF document.
PS We are hosting the web sites where it does work and were it doesn't work
and I'm testing using my PC. The only difference is the version of the
application that returns the PDF document. All the machines are 2000
servers with IE 6.0 SP1.
Thanks
Jim
Response.Clear()
Response.ContentType = objHttpConn.getResponseHeader ("Content-Type")
if Instr(1,Response.ContentType,"pdf",vbTextCompare) > 0 then
Response.AddHeader "Content-Type", "application/pdf"
Response.AddHeader "Content-Disposition",
"inline;filename=Statement.pdf"
Response.BinaryWrite objHttpConn.ResponseBody
else
Response.Write objHttpConn.ResponseText
end if
I have an application that returns a PDF document to the browser (not as a
download). The document is returned in a new window. This works fine in
most installations, but I have one installation where it doesn't work in IE,
but does work in Netscape. At the installation where it doesn't work IE
returns the file download dialog box instead of just opening the file. When
I click open or save it complains that it can't find the file. I suspect
the problem is with the file name. IE is generating a very long file and
I'm guessing it is getting confused. My code did not originally set the
file name, so I'm trying to solve the problem by setting the file name.
Here's the code that I'm using, but it doesn't seem to have any affect.
Does anyone see why this doesn't work? objHttpConn is an HTTP control that
is used to retrieve the PDF document.
PS We are hosting the web sites where it does work and were it doesn't work
and I'm testing using my PC. The only difference is the version of the
application that returns the PDF document. All the machines are 2000
servers with IE 6.0 SP1.
Thanks
Jim
Response.Clear()
Response.ContentType = objHttpConn.getResponseHeader ("Content-Type")
if Instr(1,Response.ContentType,"pdf",vbTextCompare) > 0 then
Response.AddHeader "Content-Type", "application/pdf"
Response.AddHeader "Content-Disposition",
"inline;filename=Statement.pdf"
Response.BinaryWrite objHttpConn.ResponseBody
else
Response.Write objHttpConn.ResponseText
end if