INFO: Why aren't the images in the server cache being deleted? (Legacy Web Controls)


Legacy Controls NOTICE

This article references our legacy Web Forms Web Viewing controls (WebImageViewer, WebAnnotationViewer, WebThumbnailViewer). It is preserved for archival purposes, but support strongly recommends using our modern HTML5 web controls: WebDocumentViewer, WebDocumentThumbnailer instead)

INFO: WebDocumentViewer Whitepaper - Getting Started With Web Viewing

Main Article Content

Because of the nature of session state and components, it was impossible to tell ASP.NET if the web browser had been closed, or the session had expired. This can be done outside of a component, but the goal was to keep as much inside the control as possible.

In order to delete the old files, the control checks the cache for old files on the first time it is loaded by a particular session.

So if the control is never run again, the files will never be deleted. They will also not be deleted if you are using the same SessionID as the files that are supposed to be deleted. This can happen if you leave your browser open for longer than the CacheLifeTime, and the control has not been run by any other sessions in between.

The control checks the .dts (date time stamp) file's time created stamp, and if the present time is past the the file's time stamp + CacheLifeTime, it will delete all files that begin with that SessionID. This also makes it so that you can create your own temporary files, by prepending the SessionID to the filename.

Original Article:

Q10056 - INFO: Why aren't the images in the server cache being displayed?