Solved

How to send binary to client by asp

Posted on 2000-03-22
6
440 Views
Last Modified: 2008-01-09
i want create binary file by asp. and then send it to client.
Can you help me ?
thanks
0
Comment
Question by:longpxt
6 Comments
 
LVL 10

Expert Comment

by:Yury_Delendik
ID: 2648107
You may write ActiveX and use it in ASP page
0
 
LVL 10

Expert Comment

by:Yury_Delendik
ID: 2648130
For example: ActiveX obtain parameters and pass to ASP SafeArray with binary context of file.
<%
  Set o = CreateObject("myobj.filegen")
  o.param = "blahblah"
  Response.ContextType = "mytype/myformat"
  Response.BinaryWrite o.GeFile
%>
0
 
LVL 1

Expert Comment

by:msvarma
ID: 2648261
Well Mr.longpxt I think the below code should help U.


<!-- To create a Binary File in ASP //-->
<%Set ms = CreateObject("Scripting.FileSystemObject")%>
<% msv = "whatever text u want to send"%>
<%Set a = ms.CreateTextFile(msv,True)%>
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Expert Comment

by:Yury_Delendik
ID: 2652975
What are you waiting for?
0
 

Accepted Solution

by:
Ablater earned 200 total points
ID: 2655698
Yury,

Outputting binary is achieved in visual basic by using the reponse.binarywrite function. This functions differs from the standard response.write by allowing binary characters (that would otherwise cause problems with request) to be written to the client.

It's easy enough to use visual basic to write a binary loader, so that you could for example read an image. You'll just load the binary of the file into a byte array, or variant, and pass it back to the calling page with your active X object.

There is one important consideration however when using this method: The type of binary file you are sending to your client. These are in the standard mime type format. You'll need to check which one will fit your application.

image/gif is for a .gif file for example, while image/jpeg is for a JPEG file. You need to specify the content type. (Check your help file for this, it is there)

It goes something like this:

<% Response.ContentType = "image/JPEG" %>

You have to also remove ALL HTML headers. Visual Interdev likes to fill these in, and if they (or any spaces or additional characters other than the file type) are there, they will corrupt your file transfer.

You also need an active X object to deliver the binary data to you. The built in filesystem object of ASP only does text files. (You can load them, but they corrupt when you transfer them)


0
 

Author Comment

by:longpxt
ID: 2655735
I don't know how to create built activeX object to deliver the binary data.
You can give me location of this object to download it
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now