470,596 Members | 1,528 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Sending binary file (PDF) over SSL using ASP script

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
%>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Jan 24 '06 #1
0 1733

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Kubaton Lover | last post: by
5 posts views Thread by AlexCDM | last post: by
1 post views Thread by news | last post: by
1 post views Thread by C#Schroeder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.