473,385 Members | 1,769 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,385 software developers and data experts.

return binary content from within ASPX page

my aspx page gets binary data with ms-word file. (just
byte[] array). I want this data to send back to the
browser, but when i try to do this with the following
method:
byte[] binaryData =....
Response.BinaryWrite(binaryData);

the binary data is appended with some html header .
Obviously winword does not recognize the file format.

The question is:
How to reply the browser in a way, that it would
recognize the file format and open the file ?

Thanx for any suggestions
Michal Januszczyk
Nov 17 '05 #1
2 3341
You're missing a few vital lines of code:

Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition", "inline;filename=test.doc");

Response.OutputStream.Write(binaryData);

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"michal januszczyk" <mi***************@hotmail.com> wrote in message
news:02****************************@phx.gbl...
my aspx page gets binary data with ms-word file. (just
byte[] array). I want this data to send back to the
browser, but when i try to do this with the following
method:
byte[] binaryData =....
Response.BinaryWrite(binaryData);

the binary data is appended with some html header .
Obviously winword does not recognize the file format.

The question is:
How to reply the browser in a way, that it would
recognize the file format and open the file ?

Thanx for any suggestions
Michal Januszczyk

Nov 17 '05 #2
Michal,
In a javascript function: window.open(.....).. Look it up to see the params.

Louis Dascoulias, AWS

"Michal Januszczyk" <mi***************@hotmail.com> wrote in message
news:06****************************@phx.gbl...
-----Original Message-----
You're missing a few vital lines of code:

Response.ContentType = "application/ms-word";
Response.AddHeader("Content-
Disposition", "inline;filename=test.doc");
Response.OutputStream.Write(binaryData);


Thanx !
I still have another tiny problem I can't handle:
I would like the returned content to be opened in new
window. Is it somehow possible to specify this on aspx
page ?

Nov 17 '05 #3

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

Similar topics

1
by: Randy Developer | last post by:
Ok, I've searched the web and newsgroups for a week now with no concrete answer. Question: How, if possible, can you either navigate to or get a listing of a directory to load on an asp page and...
8
by: ALI-R | last post by:
How do I allign all my content in aspx page in the middle of page like a lot of websites ? Dose it work with differnet screen resolutions? Thanks for your help.
0
by: Raed Sawalha | last post by:
I wondering what should I do to embed Outlook Web Access within aspx page (say inside frame or iframe).
0
by: KatB | last post by:
I have an aspx page with a button on it (Button1), and a ascx control with a text field and a button (Button2). When I click Button2, Button1 fires. Since ascx doesn't allow <form> tags, I can't...
6
by: Ronald S. Cook | last post by:
I have an ASPX page that returns XML to the calling client. While the code below works, I don't think it's proper because it's not encoded as XML. I.e. special characters might screw things up. ...
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
1
by: teejayem | last post by:
I have created a UserControl within a Class Library Project type. I will be using this as I want the object to perform some ClientSide scripts. I have built the project and copied the DLL to the...
23
by: shashi shekhar singh | last post by:
Dear sir, I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser , using , string str=directory.getfiles("");...
9
ssnaik84
by: ssnaik84 | last post by:
Hello, I am trying to integrate FlexBox It uses JSON data to populate listbox items. It internally calls a server side page with AJAX, and reads the JSON results from that page. for example,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.