473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ASP, DOC, RTF, ADODB.Stream, ContentType, BinaryWrite, and ReplaceB()

I'm using the example shown at :
http://support.microsoft.com:80/supp.../q276/4/88.asp

It involves using ASP/VbScript and ADODB.Stream to read binary data from a
*.DOC or *.RTF
file and then send it to the user with Response.ContentType and BinaryWrite.

Everything works fine until I try to Replace() certain strings in the *.RTF
file with my own
data. I'm assuming Replace() is choking on the binary characters, or
incorrectly thinking 0x00 values are
marking end of string.

Is there some kind of ReplaceB() function that I can use instead of lines
#10 and #11?

1> Set fs = Server.CreateObject("ADODB.Stream") ' Since FileSystemObject
can't read binary data
2>
3> fs.Type = 1 ' adTypeBinary=1
4> fs.Open
5> fs.LoadFromFile fNameFull
6> fullDoc = fs.Read
7> fs.Close
8> Set fs = Nothing
9>
10> fullDoc = Replace(fullDoc, "%g_name%", "Joe Smith")
11> fullDoc = Replace(fullDoc, "%g_date%", "12-31-2004")
12>
13> Response.Buffer = vbTrue
14> Response.ContentType = "application/msword" ' or "application/rtf"
15> Response.BinaryWrite fullDoc
16> Response.Flush
Jul 19 '05 #1
0 2548

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

Similar topics

7
by: Robert Brown | last post by:
Hi All, I am creating an interface into a Payment Gateway. I need to access a URL (which is a perl script) with paramters attached. I will then get a response within 10 seconds with information...
1
by: JohnWayne | last post by:
Hello All, I am trying to use ADODB.Stream , to write a graphic to the asp page. However I cannot seem to send my byte Array to the objStream.Write (mybyteArray) Does anyone know how to...
2
by: Avi | last post by:
hi, Can anyone tell me what the problem is and how to solve it The following piece of code resides on an asp page on the server and is used to download files from the server to the machine...
0
by: microsoft | last post by:
Hi, I have an ASP script that initiates a ADODB.Stream like below first bit gets filename from the database strAbsFile = getfilefromDB(request.querystring("fileid")) '-- create FSO object...
11
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and...
4
by: Fresh_Air_Rider | last post by:
Hi In the "good old" Classic ASP days, I used to stream records from a SQL Server database out to the user's browser in CSV format by using a combination of COALESCE and the ADODB.Stream object....
7
by: iporter | last post by:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script...
2
by: jesper_lofgren | last post by:
Hello, I have a bytearray with a pdf document inside. I whant to stream it to the client (explorer IE) for download. I just got the bytes writen on the screen , like %PDF-1.4 %???? 10 0...
10
by: =?Utf-8?B?SnVhbg==?= | last post by:
Hi! I want to use ASP to download big files using ADODB.STREAM. It works very fine with files smaller than 80 MB. On the Webserver I can see that memory allocation and the process w3wp is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.