473,624 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject( "ADODB.Stre am" ) ' Create the object
oStream.Open ' Open our file
oStream.Type = 1 ' 1 = Binary
oStream.LoadFro mFile 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.AddHea der "Pragma", "no-cache"
Response.AddHea der "Expires", "Mon, 1 Jan 2000 05:00:00 GMT"
Response.AddHea der "Last-Modified", Now & " GMT"
Response.Expire s = -1
Response.Conten tType = "applicatio n/pdf"

Response.Binary Write getBinaryFile( strFilename )

Response.End
End if
%>
>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >

Jan 24 '06 #1
0 1845

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

Similar topics

8
8691
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 in the browser rather than seeing the PDF loaded by Adober Reader. I've done with with Perl, but I've never tried this with PHP. Can someone point out what I'm doing wrong and how to fix it so that my PHP script can serve PDFs? <?php...
2
2301
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 Settings\Frostillicus\Local Settings\Temporary Internet Files\Content.IE5\U7GXENGF\file.zip The URL to open the zip file is like this: doc_view.asp?id=1&ver=2 ....where id and ver represent the zip file's version in the database. The code I've pieced...
5
8036
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 the JPEG file to the PDF (intended as a text file); I've tryied with the FileStream class, but it won't work, maybe bacause, somehow, the binary data "changed" during the read/write process. Is there any method to copy the data without changing...
4
4222
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. I need to be able to print shipping labels from a web page within this application. The shipping label data is pulled from a 3rd party application and comes in binary format specific for certain brands of label printers. I have a class library...
1
2380
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, etc.) (If this can all be done in PHP, that'd be great.) But, how do I tell the shell script what the file name is supposed to be? Here's what I have so far: from the PHP script:
1
2982
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. Like is an object, array, interger, etc.. Also can you point me in the right direction to viewing the file? Thanks in advance
9
4210
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 with binary files, I cannot use character strings, so I chose integer array instead. But the problem is that how can I display them in stdout? I tried "%c"
7
9782
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 achieve this. Thanks
5
7784
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 examples of attachment scripts. Unfortunately, i have had no luck trying to execute my script. Every time i attempt to execute the script i receive the following response: Global symbol "$msg" requires explicit package name at attach1.pl line...
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.