Solved

How to send binary to client by asp

Posted on 2000-03-22
6
447 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending ASP to server side 8 43
GitHub 1 39
Split on ASP 8 51
I'm looking for a dynamic length jQuery/javascript currency editor mask? 2 64
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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