R
rolfejr
I am trying to display a PDF in the users browser that is pulled from a
binary field in our database, and keep that PDF from caching on the
client computer. I can successfully pull the PDF and display it using
the following code:
Response.ContentType = "application/pdf"
Response.BinaryWrite objRS("Attachment")
where objRS("Attachment") is a reference to the binary field retrieved
from the database. However, I have tried adding virtually every header
known to have anything to do with caching, and I cannot seem to prevent
the PDF from caching in the client's browser. So then I tried to use
the adodb.stream object, as follows:
set objStream=server.createObject("ADODB.Stream")
objStream.Open
objStream.Type=1 'adTypeBinary
objStream.write objRS.fields("Attachment").value
Response.ContentType = "application/pdf"
Response.BinaryWrite objStream.Read()
This follows, more or less, several examples I've found on the web,
although most examples are reading a file into the stream, not a binary
field returned from a database. This code gives me the following
error:
Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.
I'm looking for a way to make the stream work, or any other suggestions
on how to display the pdf to the client without it caching in their
browser.
binary field in our database, and keep that PDF from caching on the
client computer. I can successfully pull the PDF and display it using
the following code:
Response.ContentType = "application/pdf"
Response.BinaryWrite objRS("Attachment")
where objRS("Attachment") is a reference to the binary field retrieved
from the database. However, I have tried adding virtually every header
known to have anything to do with caching, and I cannot seem to prevent
the PDF from caching in the client's browser. So then I tried to use
the adodb.stream object, as follows:
set objStream=server.createObject("ADODB.Stream")
objStream.Open
objStream.Type=1 'adTypeBinary
objStream.write objRS.fields("Attachment").value
Response.ContentType = "application/pdf"
Response.BinaryWrite objStream.Read()
This follows, more or less, several examples I've found on the web,
although most examples are reading a file into the stream, not a binary
field returned from a database. This code gives me the following
error:
Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.
I'm looking for a way to make the stream work, or any other suggestions
on how to display the pdf to the client without it caching in their
browser.