I have an attachment whose data(of type varbinary) and MIME type come from the DB. When the user clicks on a link, I get the data and write it to HttpContext.Response.BinaryWrite. Currently, I have the user force download the attachment with
r.AddHeader("Content-Disposition", "attachment; filename=" + a.FileName);
Instead, I'd like for the file to open, I tried
r.AddHeader("Content-Disposition", "inline; filename=" + a.FileName);
However, this just opens the image files, all other types of attachments get downloaded automatically. How do i get these files to display as well? If these cannot be displayed, I'd like Windows to handle it by displaying the "Open With" dialog.
In this question that I've posted, someone said that I can render an html view of the file, I'm not sure how that can be done. I'm using the .NET environment with C#.
Any thoughts on this would really help.