Solved

How to send binary to client by asp

Posted on 2000-03-22
6
446 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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