Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > return binary content from within ASPX page

Reply
Thread Tools

return binary content from within ASPX page

 
 
michal januszczyk
Guest
Posts: n/a
 
      07-17-2003
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
 
Reply With Quote
 
 
 
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      07-17-2003
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" <(E-Mail Removed)> wrote in message
news:02b701c34c42$755b0e00$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Louis Dascoulias
Guest
Posts: n/a
 
      07-17-2003
Michal,
In a javascript function: window.open(.....).. Look it up to see the params.

Louis Dascoulias, AWS

"Michal Januszczyk" <(E-Mail Removed)> wrote in message
news:06d101c34c45$923afe60$(E-Mail Removed)...
> >-----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 ?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
How to fire off a completely seperate .aspx page from within an .aspx web page. S_K ASP .Net 1 10-02-2007 12:05 AM
How to fire off a completely seperate .aspx page from within an .aspx web page. S_K ASP .Net 0 10-01-2007 10:40 PM
How to fire off a completely seperate .aspx page from within an .aspx web page. S_K ASP .Net 0 10-01-2007 10:40 PM
How to fire off a completely seperate .aspx page from within an .aspx web page. S_K ASP .Net 0 10-01-2007 10:40 PM



Advertisments