Retrieve binary data from database and displaying in asp.net control

Hi,
   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 asp.net label or other asp.net 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 asp.net control. Can you guys give a clue how to do this?...Thanks in advance
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = FileDownloaded.Content_Type;
                Response.BinaryWrite(FileDownloaded.Ms.ToArray());
                Response.AddHeader("Content-Disposition", "attachment; filename=" + FileDownloaded.File_Username);
                Response.End();
               
             
           
RajeshbalaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cyberkiwiCommented:
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.
0
cyberkiwiCommented:
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

http://www.shaunakelly.com/word/sharing/OpenDocInIE.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.