Sending binary file (PDF) over SSL using ASP script

Discussion in 'ASP General' started by AirYT, Jan 24, 2006.

  1. AirYT

    AirYT Guest

    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
    %>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    AirYT, Jan 24, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. carsten801
    Replies:
    4
    Views:
    33,137
  2. Robert
    Replies:
    2
    Views:
    1,939
    Robert
    Jun 10, 2004
  3. Sam

    Problem sending XML over SSL

    Sam, Nov 30, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    160
    Dan Rogers
    Dec 1, 2004
  4. YT
    Replies:
    1
    Views:
    251
    Alan Howard
    Apr 30, 2004
  5. Ricardo Pog
    Replies:
    1
    Views:
    375
    Austin Ziegler
    Mar 26, 2008
Loading...

Share This Page