0

i want to display *doc,*xls,*pdf in browser window instead of their respected application. i have tried following code, but no luck it prompt me dialog for save/open instead of displaying in browser

    //Set the appropriate ContentType.
    Response.ContentType = "Application/msword";
    //Get the physical path to the file.
    string FilePath = MapPath("wordfile.doc");
    //Write the file directly to the HTTP content output stream.
    Response.AppendHeader("Content-Disposition", "inline;filename=" + "wordfile.doc");
    Response.WriteFile(FilePath);
    Response.End();

please help
thanks

Gourav Goyal
  • 37
  • 1
  • 1
  • 4

1 Answers1

0

for any of these proprietary formats you need browser plugins/extensions or ActiveX for IE
Am not sure if its available for office formats.
For PDF setting the content type to "application/pdf" and Content-Disposition to inline should work.

Vignesh.N
  • 2,618
  • 2
  • 25
  • 33