views:

722

answers:

2

Even if the image is changed, overwritten, modified, IIS still serves the cached copy. I am trying to upload an image from a webcam taken every 15 seconds. The image makes it onto the server but when I refresh the browser with the image FROM the server it does not refresh.

IIS caches the file apparently for more than 2 minutes. I want this to be in real-time. Tried disabling caching everywhere I could think of. No luck.

A: 

Embed your image as follows: <*ImageTag src="WebCamImage.aspx?data={auto-generated guid}" ... > *ImageTag = img (spam filter won't let me post it)

And create a page (WebCamImage.aspx) that streams the static image file back to the browser while ignoring the "data" request parameter, which is only used to avoid any caching (make sure to set the response content type to "image/jpeg" or whatever is adequate in the @page header).

ZeroConcept
+1  A: 

Are you sure that the image is cached on the server and not on the client. Have you tried requesting the same image from a different client?

If this IS server side caching then this article has all the answers for you: http://blogs.msdn.com/david.wang/archive/2005/07/07/HOWTO-Use-Kernel-Response-Cache-with-IIS-6.aspx

You are most likely "affected" by the kernel-mode caching. See that scavenger time? Scavenger - 120 seconds by default and controlled by the registry key HKLM\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\UriScavengerPeriod That is probably what you experience (2min caching)

Try turning kernel-mode caching off to see if it makes a difference (performance may suffer but it will be no worse than IIS5)

DmitryK