Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to send binary to client by asp

Posted on 2000-03-22
6
Medium Priority
?
449 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

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

Accepted Solution

by:
Ablater earned 600 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

704 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