I need to develop a web application to open an ODT file when I click an image button in the browser. Below is the code that I used to open the file on a button click. It works for a Word document but it is not working for an Open Office document. How can I do this?
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="ImageButton 1"
Image
ImageUrl="images/pict.jpg"
OnClick="imagebutton1_Click"/>
protected void imagebutton1_Click(object sender, ImageClickEventArgs e)
{
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
Response.AddHeader("Content-disposition", "inline; filename=TestDoc.docx");
String path = Server.MapPath("TestDoc.docx");
Response.WriteFile(path);
Response.End();
}