Note that there are some explanatory texts on larger screens.

plurals
  1. POIE 8 and client-side caching
    text
    copied!<p><strong>Background story:</strong></p> <p>I have a web portal in .NET 3.5 on an IIS 6 web server. Currently there is a page that is given a value and based on that value looks up a PDF file on a web service and displays the results to the user in another tab in the web page. This is done with the following code.</p> <pre><code> context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.Clear(); context.Response.AddHeader("Accept-Header", pdfStream.Length.ToString()); context.Response.ContentType = "application/pdf"; context.Response.BinaryWrite(pdfStream.ToArray()); context.Response.Flush(); </code></pre> <p>This works and has worked for years. However we got an issue from the client that a particular client was having the PDF returned as the same PDF every time until they cleared temp internet cache.</p> <p>I thought oh cool, this is an easy one. I will just add the cache headers to the response to never cache it. So I added the following:</p> <pre><code>context.Response.Cache.SetCacheability(HttpCacheability.NoCache);//IE set to not cache context.Response.Cache.SetNoStore();//Firefox/Chrome not to cache context.Response.Cache.SetExpires(DateTime.UtcNow); //for safe measure expire it immediately </code></pre> <p>After a quick test I got exactly what I was expecting in the response header.</p> <pre><code>Cache-Control no-cache, no-store Pragma no-cache Expires -1 </code></pre> <p><strong>The Problem:</strong></p> <p>So this went live. Everything seemed cool day one. The day after, bam, everyone started getting white screens and no PDF displayed. After further investigation, I found out it was only IE 6,7,8. Chrome is fine, Firefox fine, safari fine, even IE 9 fine. Without knowing the why this happened, I reverted my change and deployed it, and everything started worked again.</p> <p>I have searched all over trying to find out why my caching headers seemed to confuse IE 6-8 to no avail. Has anyone experienced this type of issue with IE 6-8? Is there something I am missing? Thanks for any insight.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload