While google chrome has no issue - ie. it allows the download of a file over SSL fine. IE8 in non SSL mode (http) also allows download but not in SSL mode(https). I read so many articles on this issue and almost all are directing to set IE settings or make
the headers not to cache the document but nothing worked! Here is a short list:
http://support.microsoft.com/kb/815313 : I have made sure that the "Do not save encrypted pages to disk" is not checked off. It also has recommendations on not to send "Cache-Control: No Store" or "Cache-Control:
No Chache" header from the server - refers to another kb article 812935. I was not setting any explicit headers anyway.
https://support.microsoft.com/kb/323308?wa=wsignin1.0 : Per this article, it says to edit registry..I have not tried this solution yet but at the last resort.
One solution tells me add these three lines to page load :
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
Nothing helped. Every single change in my code on server side made no change and every time I got the following error message with red-cross (I couldn't paste error message): but it said :
"Unable to download <filename> from <server name>
Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
Here is the short code I am using on button click event:
ProtectedSub
btnNASEquipUserManualOpen_Click(ByVal
sender AsObject,ByVal
e AsEventArgs)
Dim
fPath AsString
= "full path to .pdf"
Dim
myDoc As
IO.FileInfo
= NewFileInfo(fPath)
Response.Clear()
'Response.AppendHeader("Pragma", "no-cache")
Response.ContentType ="Application/pdf"
Response.AddHeader("content-disposition","attachment;filename="+
myDoc.Name)
Response.AddHeader("Content-Length",
myDoc.Length.ToString())
'Response.AddHeader("Cache-Control", "private")
'Response.AddHeader("Cache-Control", "max-age=15")
'If Request.Browser.Browser = "IE" Then
'Response.Cache.SetCacheability(HttpCacheability.NoCache)
'Response.AppendHeader("Pragma", "no-cache")
'End If
Response.ContentType ="application/octet-stream"
Response.WriteFile(myDoc.FullName)
Response.End()
End
Sub
----
The commented green lines are all my wasted efforts! href solution would be the ultimate one..I will try registry edition solution first but I will wait till I exhausted takeing
suggestions! Thanks in advance!
----
One thing I like to mention that I am looking for a solution which can be implemented on server side..since even registry solution sounds like has to be on client side..but I have
no control on client side. Thanks and looking forward to hear from you!
----
It gets weird even more..On the same webserver, in the same solution, I have two projects, each with a page with identical button click event and each one is allowing end user to
downaload user manual. Weird part is: one allows download in https but not the other!!! Again no issue with Google Chrome and also when IE is running in http (and not https) but problem to download under https. I have confirmed that for testing, I have unchecked
the checkbox of "Do not save encrypted pages to disk" in IT security settings (tools->Advanced Tab -> scroll down to Security) but still no go!
----
NEVER MIND!!! I HAVE CHANGED MY PAGE TO USE HREF instead which works like charm!!!