473,382 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Sending binary file (PDF) over SSL using ASP script


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

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.


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

End if

Jan 24 '06 #1
0 1826

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Kubaton Lover | last post by:
I have a pdf file (syllabus.pdf) on the server. I have written the following PHP code. It correctly finds the file, but it is sending the file back as text I think because I'm seeing the binary...
by: Frostillicus | last post by:
I'm trying to get an ASP to return a zip file to the remote browser from an Image (BLOB) field in SQL Server 2000 but Internet Explorer keeps saying: Cannot open C:\Documents and...
by: AlexCDM | last post by:
Greetings; I'm a (young) .NET developer and I have this problem: I'm building an application (with C#) that creates PDF files. To display a JPEG image within the PDF I need to copy the data from...
by: Schwarty | last post by:
I hope I posted this to the correct group. If not, please let me know and I will get it posted in the correct section. I have a web application developed in ASP.NET using C# for the code behind....
by: news | last post by:
At the end of a PHP script, I'm sending a file via FTP to a server. I thought it'd be best to use a shell script in order to automate the FTP (logging in, changing to binary, putting the file,...
by: C#Schroeder | last post by:
I am working on a project where I have to take a binary file and convert it to a PDF file. The binary file is stored in a database as a Varbinary. What is the best way to store the binary file....
by: loudking | last post by:
Dear all, I am writing a client-server application and the client should upload a file to the server, then the server should display the content of the file in stdout. Because I have to deal...
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
by: xmaverick | last post by:
Hello, I'm a newbie to perl and i'd like some assistance trying to figure out how to send an attachment using MIME::Lite. I have searched the net far and wide and have used and modify different...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.