Problem in opening doc/docx/excel files in browser(Asp.net, C#)
<p>I am storing some files like PDF,Doc, Docx, xls etc. in the file system.</p>

<p>Now I have to show those files on the browser for the users to view.</p>

<p>So basically a link button is there in a datagrid, upon clicking on which the user will be able to view.</p>

<p>So far my code goes like this</p>

<pre><code>      Response.Clear();

   // Response.ContentType = "application/pdf";
    //Response.ContentType = "application/x-msexcel";       
    //Response.ContentType = "application/msword";

    string strFilePath = @"C:\test.pdf";
   // string strFilePath = @"C:\test.doc";

    Response.WriteFile(strFilePath);
    Response.End();
</code></pre>

<p>This works fine for pdf files but fails for word or excel files. In the browser I am able to  view the pdf but the other files are not opening in browser but are asking for the </p>

<p>"Save" , "Open" dialog box option. If I click on "Open", it will open in a normal window instead of browser.</p>

<p>How can I achieve my target? The browser is IE</p>

<p>Thanks in advance</p>
