Link to home
Start Free TrialLog in
Avatar of syyung6
syyung6

asked on

PDF doesn't show in ie over https

I generate PDFs using Fop. All PDF docs are displyed over HTTP. When i switch it to HTTPS,  IE gives the following error:

"Internet Explorer cannot download ... xxxx from www.xxxxxxxx.com.

Internet Explorer was not able to open this internet site. The requested site is either unavailable or cannot be found. Please try again later."

(xxxx is the url)

I'm using IE version 6.0 with SP2, while using firefox doesn't get the above error.
Avatar of RedKelvin
RedKelvin

Avatar of syyung6

ASKER

Thanks. That means i have to unset no-cache in the header....
but as it is a dynamic content, we are resistant to doing so....
ASKER CERTIFIED SOLUTION
Avatar of Asta Cu
Asta Cu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
FIX: Mixed security warning message appears when the POST method is used to stream a PDF file over HTTPS
When you use a POST method over HTTPS to access a server script that streams back a Portable Document Format (PDF) file, you may receive the following warning message: This page contains both secure and non-secure items. Do you want to display the...
http://support.microsoft.com/default.aspx?scid=kb;en-us;321532
"Internet Explorer Cannot Download" Error Message When You Use an HTTPS URL to Open an Office Document or PDF File
When you try to open a Microsoft Office document or a PDF file by typing an HTTPS Uniform Resource Locator (URL) for the document on the Address bar in Internet Explorer 6 Service Pack 1 (SP1), the document may not open, and you may receive the...
http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
You receive an error message when you try to download a portable document format (.pdf) file from Live Meeting
Describes a problem that occurs where Internet Explorer cannot download from a .pdf file from Live Meeting.
http://support.microsoft.com/default.aspx?scid=kb;en-us;871103
Cannot Open Files on Secure Servers
When you attempt to open a file on a secure (HTTPS://) Web site, you may not be prompted whether you want to open the file from its current locations or save it to disk. Instead, a Save As dialog box may appear, prompting you to choose a location...
http://support.microsoft.com/default.aspx?scid=kb;en-us;254324
give the points to astaec
Again, thank you very much for your diligence in finalizing these questions.
":0) Asta
This question has been closed for a while but here is my solution to this problem, as alot of questions on this topic appear to be unanswered. (credit to others as this code snippet is a collection of other solutions).


// set the file path
			FileInfo file = new FileInfo(@"C:\file.pdf");
			// if connection is over https and in IE
			if ((Request.Browser.Browser.Equals("IE")) && (Request.ServerVariables["HTTPS"].ToLower().Equals("on")))
			{
				// Clear the content of the response
				Response.ClearContent();
				// set the cacheability for https connections
				Response.Expires = 0;
				Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
				Response.AppendHeader("Pragma", "public");				
				// Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
				Response.AddHeader("Content-Disposition", "attachment; filename="+file.Name);
				// Add the file size into the response header
				Response.AddHeader("Content-Length", file.Length.ToString());
				// Set the ContentType
				Response.ContentType = "application/pdf";
				// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
				Response.TransmitFile(file.FullName);
				// End
				Response.End();
			}
			else
			{
				// Clear the content of the response
				Response.ClearContent();
				// LINE1: Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
				Response.AddHeader("Content-Disposition", "attachment; filename="+file.Name);
				// Add the file size into the response header
				Response.AddHeader("Content-Length", file.Length.ToString());
				// Set the ContentType
				Response.ContentType = "application/pdf";
				// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
				Response.TransmitFile(file.FullName);
				// End the response
				Response.End();
			}

Open in new window