Retrieve binary data from database and displaying in control

   I am storing Microsoft word document as varbinary(Max) on sql server 2005 db. I want to take the binary data (contents) from the database and display on the aspx page in label or other controls.
    I am able to retrieve the data as Memory Stream object and bind to response object as below. But i don't want to open this content in word doc or in a seperate browser window. I want to retrieve the data and display in a control. Can you guys give a clue how to do this?...Thanks in advance
                Response.ContentType = FileDownloaded.Content_Type;
                Response.AddHeader("Content-Disposition", "attachment; filename=" + FileDownloaded.File_Username);
Who is Participating?
Actually, I lie. I have stopped using IE for so long that I don't remember it - I use Chrome/Firefox nowadays.  But even in IE, there is a setting for whether to show it in the browser or force launch of app outside of browser
The closest I could suggest is to put an iframe into a div tag and to load the content into the iframe.
You would have to change the "Content-Disposition" to "inline;" instead of "attachment;", but that only works for PDF and some other documents.  I haven't seen Word documents open within the browser itself yet.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.