title: Classic ASP - IIS 5 to IIS 6 migration causes image caching problems?
body: <p>Apologies in advance for the long-winded question.</p>
  
  <p>I'm really a database programmer, but have inherited support of a classic-ASP intranet application which has recently been migrated from IIS 5 to a new server running IIS 6. The user-base is about a dozen, all using IE 6.</p>
  
  <p>The UI displays hierarchies of items returned from a database, using a combination of  HTML unordered lists and javascript to hide/expand branches as the user navigates.</p>
  
  <p>Images are displayed next to the list members with CSS (using list-style-image), using a different image for each type of item. The number of different item types (and therefore images) in a hierarchy varies between 2 and 10. Hierarchies vary between 20 and 200 items.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>Since the migration to IIS 6, several users have experienced a problem which appears to be caused by images failing to be properly applied to one or more items in the hierarchy; the list displays correctly, but one or more images is missing and clicking on any link causes an empty page to load.</p>
  
  <p>Analysis of network traffic using Wireshark and the IIS logs show that the problem isn't on the server side - all content has been correctly supplied to the client. </p>
  
  <p>The issue appears to be related to content caching at the client: it seems to more often affect users who have not used the application before on their current PC, or have not used it for some time. 
  Also, I can replicate the issue approximately one attempt in three by starting a session, clearing my browser cache and then refreshing the page. However, the same is true of the application when running on IIS 5, so this issue may have existed before the migration to IIS 6 but have happened less frequently.
  Occasionally, if I leave the session for 20 minutes or so, the browser seems to "find" the missing images, and everything works OK.</p>
  
  <p>If the application is accessed through a local proxy (I used Fiddler) the problem never occurs, although the Fiddler connection log shows one or more connections made to the server to retrieve the images has aborted. As before, network traffic shows that the image was returned by the server. However, using the proxy seems to enable IE to find other successfully retrieved copies of the image from the cache.</p>
  
  <p>I've reached the point where I'm at the end of my limited knowledge of debugging ASP/IIS issues.
  Removing the list-style-images from the CSS fixes the problem, but this has to be the option of last resort since it makes the application more difficult to use.</p>
  
  <p>Any suggestions on how I can proceed would be gratefully received.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>AnonJr suggests that this must be a client configuration issue, as all other components appear to be functioning correctly. </p>
  
  <p>I discounted a simple client configuration issue because this is the only application affected by the issue described
  I have tested all the options under Tools > Internet Options > Temporary Files > Settings with no change in behaviour. </p>
  
  <p>What other client configuration options should I be considering?</p>
  
  <p><strong>Edit 2 - a solution</strong></p>
  
  <p>The accepted answer prompted me to search for a known issue with IE6 requesting multiple copies of images when HTML is generated from client-side script - <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;319546" rel="nofollow noreferrer">http://support.microsoft.com/default.aspx?scid=kb;en-us;319546</a>.</p>
  
  <p>The article (having stated that this behaviour is "by design") suggests a work-around of pre-caching the required images by loading them into an invisible DIV:</p>
  
  <pre><code>&lt;DIV style='display:none'&gt;&lt;IMG SRC='image.gif'&gt;&lt;/DIV&gt;
  </code></pre>
  
  <p>This appears to work for me - I can no longer replicate the problem by clearing my browser cache in the middle of a session, and a Fiddler trace shows each image being requested only once.</p>
  
  <p>I did find one caveat which I wasn't aware of before; the IE cache is case-sensitive, so a cached image will only be used if the case of the file name specified in the invisible DIV matches that used elsewhere in the page.</p>