Question

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)

Was it helpful?

Solution 2

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"/>

OTHER TIPS

You may want to run fiddler or firebugs or whatever to capture your response header.

My guess is this is an issue with IE and how it handles expiration headers.

Check out this link

Here is a similar (if not the exact same) issue I had myself. Link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top