On my site, users can upload images that are displayed publicly. When the user uploads a new image, it overwrites one of their old images.
Because the images can be large, I want them to be cached. However, when the user uploads a new image, the old cached images should not be used.
The source of the dynamic images looks like this:
userImage.ashx?id=f488b864-0a0b-46d9-af4a-a43cd0dcf751&type=micrositePhoto
So I can inject headers into the response in the .ashx file if I need to.
I've been told to use etags for this purpose, but I don't know how to do this in asp.net. The .js
and .css
files on my site already have etags, but I don't know what is generating them. Also, any in-built systems to generate etags will probably not understand how my .ashx file works.
How do I generate etags for my site, and make it so that they work as they are supposed to?