asp.nettrusted-sites

asp.net: IE 7 & 8 closes automatically (not trusted site)


in my asp.net application I'm calling a site, which is producing a .pdf file of the content of the viewed page.

In IE 9 everything is fine - the browser opens a new window and there the pdf file which has been created can be opened or saved.

In IE 7 and 8 the window opens, but after a second the window closes automatically and the result is, that the pdf file cannot be viewed.

This occurs only in secure internet (with https), not intranet.

If I add my site to "trusted sites" in the IE properties, then everything works fine. Can i manage this problem with some code? (I cannot simply tell my users to add the page to trusted sites)


Solution

  • I've read about 10-20 threads with the same problem as I had. Most answers are to try something like "Cache-Control: private", to clear the headers correctly, to end the response correctly, to set the "Content-Type" to "application/download" or "application/octet-stream" and other Response.ApendHeader configurations.

    The solution of my problem was, that I've created the link to the pdf-generating site with javascript. I changed it to a asp.net redirection and now it is working!

    <asp:Button id="myButton" runat="server" PostBackUrl="~/myPDFcreatingSite.aspx" Text="Create PDF"/>