return binary content from within ASPX page

  • Thread starter Thread starter michal januszczyk
  • Start date Start date
M

michal januszczyk

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
 
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);
 
Michal,
In a javascript function: window.open(.....).. Look it up to see the params.

Louis Dascoulias, AWS
 
Back
Top