Quantcast
Viewing all articles
Browse latest Browse all 3527

Suppress File Dialog with Response.WriteFile

I'm using asp.net and everytime I try to display a .docx file I get a windows prompt asking "Do you want to open or save this file?" instead of it just opening in the browser window. I do not get the dialog with .pdf files. My code is:

Response.ContentType = "application/msword";

 Response.Clear();

 Response.Charset = "";

filepath = filepath + filename;

  Response.WriteFile(Context.Server.MapPath(filepath));

   Response.End();

           

 


          


jperry


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>