Reputation: 3301
I am using the code from this article: http://weblogs.asp.net/jeff/archive/2009/07/01/304-your-images-from-a-database.aspx to cache the images I am returning from the database but I am having a problem when the user changes the image the browser is not going back to the server to check the timestamp.
I have tested this in Chrome and IE9 and chrome almost always goes back to the server to check the timestamp and if it has been edited it returns the new image, IE9 never does unless I ctrl+F5 to refresh the page.
Is there a cross browser solution that anyone knows of to make sure the browser always makes a call to the server so I can check the timestamp?
Many thanks for any help.
Upvotes: 3
Views: 2375
Reputation: 59
The same solution of user351711 with a different syntax:
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Upvotes: 0
Reputation: 3301
Setting the expiration date to the current date/time forced it to always check with the server.
Response.Cache.SetExpires(DateTime.Now);
Upvotes: 1