Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to force Word doc to open in browser instead of opening MS Word

Status
Not open for further replies.

millerk

Programmer
Jul 5, 2002
133
US
I'm using Response.BinaryWrite to display a Word doc and no matter what I do, it always opens up an instance of MS Word. I need it to open this word doc within IE because it's on a page with two frames where one side will have certain information about the document and the other frame should display the content of the word document.
Here is the code I currently have:

temp = (byte[])myDataReader.GetSqlBinary(1);
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/msword";
Response.AddHeader("Content-Disposition", "inline; filename=myfile.doc");
Response.BinaryWrite(temp);
Response.Flush();
 
I think it's down to the individual user what happens to the file (i.e. whether it is opened in the browser or in MS Word) so you may find that you don't have that much control.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Thanks.
You're right. It's in the Windows Explorer Folder options. You have to go to the registered file types and make sure the "Browse in same window" is checked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top