Last post Apr 15, 2020 03:59 AM by samwu
Apr 14, 2020 01:08 PM|baldwinjohn|LINK
I have the code below to render a pdf report on the screen. When this code is executed in Edge or Chrome it is creating a pdf file in my default folder on my local machine. In IE it does not (prompts user to open/save. How can I modify the code so that it
doesn't physically save a copy of the report in Edge/Chrome. Note - I tried using "inline" but that opens it up in the current window and for security reasons we don't have the navigation buttons available so closing the report out closes the entire app. Or
is there some way to do "inline" and open the report in a new window?
byte bytesret = ReportViewer1.LocalReport.Render("PDF",
"attachment; filename=" + fileName);
// create the file
Apr 15, 2020 03:59 AM|samwu|LINK
When this code is executed in Edge or Chrome it is creating a pdf file in my default folder on my local machine. In IE it does not (prompts user to open/save. How can I modify the code so that it doesn't physically save a copy of the report in Edge/Chrome.
I tested your code in all three browsers, but in Edge it will prompt users to open/save.
The resulr in edge:
If you want to prompt user when download the file, you can try to Content-Disposition header.
More information about the use of Content-Disposition header you can refer to this link: