Sending binary file (PDF) over SSL using ASP script

A

AirYT

Hello,

Here's a quick explanation & problem:

i have an ASP (iis v5.0) application that generates a pdf file and this file
is saved to the server. it is saved in a location not available to web
users. i have an asp script (below) that sends the pdf file to the user as a
binary stream. So that the user specifies which file to upload, the script
performs some security checking and if it passes, it sends the pdf document.

This works great in HTTP, but i want to do this using SSL. When i try the
same thing over SSL, it gives me a 'File Download' dialog box with Open,
Save, Cancel, More Info. The file name is the name of my script and file
type is 'Adobe Acrobat Control for ActiveX'.

When i click Save or Open i get an error message: Internet Explorer cannot
download [scriptname] IE was not able to open this Internet site. The
requested site is either unavailable or cannot be found. Please try again
later.

The key to all this is that the report can change and i need to make sure
the data doesn't get cached along the way. Hence there are a bunch of header
manipulation commands included in the send function.

Any help would be much appreciated.

Rgds,
yt

PDFSend.asp >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<%
Function getBinaryFile( strFilePath )
Dim oStream

Set oStream = Server.CreateObject( "ADODB.Stream" ) ' Create the object
oStream.Open ' Open our file
oStream.Type = 1 ' 1 = Binary
oStream.LoadFromFile strFilePath ' Retreive binary data from the file

getBinaryFile = oStream.read ' Return the binary data to the caller

Set oStream = Nothing ' Destroy the ADO object
End Function

if blnSecurityPass Then
' SUCCESSFUL PASS - SHOW REPORT
Response.Clear
Response.Buffer = True
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "Expires", "Mon, 1 Jan 2000 05:00:00 GMT"
Response.AddHeader "Last-Modified", Now & " GMT"
Response.Expires = -1
Response.ContentType = "application/pdf"

Response.BinaryWrite getBinaryFile( strFilename )

Response.End
End if
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top