Open Word File Directly on Client's PC without Displaying Save Dialogue Box
So Here I am with a trick to open the Word File directly on button click event without interrupting the user with that annoying Save Options Dialogue Box. So here is how we can do this,,,
Put a Button on your design page and write the following code on the button click event of that button control..
protected void Button1_Click(object sender, EventArgs e) { string FullFilePath =Server.MapPath("WordFile\\demo.docx"); FileInfo file = new FileInfo(FullFilePath); if (file.Exists) { Response.ContentType = "application/vnd.ms-word"; Response.AddHeader("Content-Disposition", "inline; filename=\"" + file.Name + "\""); Response.AddHeader("Content-Length", file.Length.ToString()); Response.TransmitFile(file.FullName); } }