Link to home
Start Free TrialLog in
Avatar of JL Network
JL NetworkFlag for United States of America

asked on

File could not be written to cache error

I am using ADODB Stream to display a PDF from a secure site to the browser.  The pdf will open on some machines, but not others.  Both are running Windows XP pro, and IE 6.0  The error I recieve is IE cannot download xxx  The file could not be written to the cache.  Does anyone have any suggestions on what may be configured to allow the download?  The code to display the file is below:

thank you

Dim oStream, retFile
      Set oStream = Server.CreateObject( "ADODB.Stream" ) ' Create the object
      oStream.Open
      oStream.Type = 1
      oStream.LoadFromFile strFilePath
      retFile = oStream.Read
      Response.BinaryWrite retFile
      oStream.Close
      Set oStream = Nothing
Avatar of kevp75
kevp75
Flag of United States of America image

sure...make sure Adobe Acrobat Reader is installed on the machines that can't open it....
SSL+ "pragma:no-cache or cache-control:no-cache" in HTTP response headers + IE6 "Tools->Internet Options->Advanced->Do not save encrypted pages to disk" causes this.

Myself, I would try swapping pragma:no-cache to cache-control:private.  Or if your PDF files don't contain "personal data" then don't bother with no-cache directives at all, just put a reasonable expiry time on it like 5 minutes.

--
Lee
Avatar of JL Network

ASKER

Advanced->Do not save encrypted pages to disk -- I have tried this already...  this is the one solution I have been able to find, and it still does not work.  I should have mentioned that..  sorry..  Also I just tried on Firefox, and it works fine there.  So far it seems to be isolated to IE 6.0, and Safari for windows.

Lee:
Can you please elaborate on what you mean by  swapping pragma:no-cache to cache-control:private??

The PDF files do contain information that is secure, so if you have a suggestion on how I can transfer them in another method to the browser, that would be great.  They are physically located in a directory outside my web site.

D:\website
D:\webfiles

And I do have Adobe Reader installed on this machine.  I also have adobe 7.0 standard

Thank you..
Sorry, just to make sure - "do not save encrypted pages to disk" needs to be unchecked.  I assume you tried both though.

RE: no-cache -> Do you know what HTTP Response Headers are present?  You may need a tool to find out such as http://www.blunck.se/iehttpheaders/iehttpheaders.html.

--
Lee
Lee:

here is what I got:

GET /PATH/getFile.asp?119 HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: www.xxx.org
Connection: Keep-Alive
Cookie: ZDA0NTYIBATBKZKDEKCIEVXEKVRKLISKW;
ASPSESSIONIDSSQCQACS=IBMB

HTTP/1.1 200 OK
Date: Thu, 23 Aug 2007 15:17:14 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Pragma: no-cache
Cache-control: private
Expires: 0
Pragma: no-cache
Cache-control: private
Expires: 0
Content-Length: 473821
Content-Type: application/pdf
Cache-control: private

thanks!
So, something somewhere is setting the response header "Pragma: no-cache", twice in fact.  And Expires: 0 (immediately).  

Cache-control: private - should not cause any problems.

Because it's there twice, it seems to be that there are two different points in the system where they are being added.  One is likely to be IIS, the other could be either by some ASP.NET configuration setting (or default) or maybe that's being done programatically.  Unfortunately they will all need removing to test this.

--
Lee
Lee:

I obtained the header info from the other PC that works, and here is what I got:

works:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)

Does not work:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

the difference I see is the last entry:
InfoPath.1 and
.NET CLR 2.0.50727

Is that the .net runtime I have installed?  Or is it anything that may be the cause?  It was the only difference I noticed in the header.  The machine that works displayed the no cache twice too, and the pdf still opens...

thanks again for the help...
Hmm, having two .net runtimes shouldn't interfere, unless one is perhaps corrupt.  Not sure what InfoPath.1 means though, but obviously not the problem.

Another thing I didn't think of is that one of your machines might have a full cache.  Try emptying the tempory internet files folder.

--
Lee
I have tried emptying the tempory files.  

I am also looking to see where the content is set to expire, and content experation is disabled on IIS.  For configuring IIS, is there another location besides the HTTP Headers tab to set expiration?  I also don't see any settings in the code to set expiration...  This is not my application, so I am trying to figure out what someone else did.

thanks...
ASKER CERTIFIED SOLUTION
Avatar of LeeKowalkowski
LeeKowalkowski
Flag of United Kingdom of Great Britain and Northern Ireland 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
Forced accept.

Computer101
EE Admin