Fed up with Browser Caching
I have an image control on my c#.net page. Users can upload images to the site and my code creates a thumbnail of that newly uploaded image and assigns it to the image control. So the image name will be always same but image changes/overwrites.
The ill point is, the image control does not refresh the newly selected image. The change takes place when I manually refreshed the page.
I found a solution: In IIS management console, select the website, open properties, select HTTP Headers tab, enable Content Expiration and select ‘expire immediately’.
This works perfectly, but in my case I don’t have the access to IIS management console in my hosting server. Therefore I need to get this thing done from the code. I have tried following tricks but none of them worked.
1) set the HTML meta tags
META HTTP-EQUIV=CACHE-CONTROL CONTENT=NO-CACHE
META HTTP-EQUIV=expires CONTENT=-1
2) I have set a cache and removed it before assigning the imageurl
Cache.Insert("image01",Thumb1.ImageUrl);
Cache.Remove(“image01”);
3) Flushing cache each time refreshing
Response.Cache.SetCacheability(HttpCacheability.NoCache)
I am exploring a way to get rid of this issue since three days.
The ill point is, the image control does not refresh the newly selected image. The change takes place when I manually refreshed the page.
I found a solution: In IIS management console, select the website, open properties, select HTTP Headers tab, enable Content Expiration and select ‘expire immediately’.
This works perfectly, but in my case I don’t have the access to IIS management console in my hosting server. Therefore I need to get this thing done from the code. I have tried following tricks but none of them worked.
1) set the HTML meta tags
META HTTP-EQUIV=CACHE-CONTROL CONTENT=NO-CACHE
META HTTP-EQUIV=expires CONTENT=-1
2) I have set a cache and removed it before assigning the imageurl
Cache.Insert("image01",Thumb1.ImageUrl);
Cache.Remove(“image01”);
3) Flushing cache each time refreshing
Response.Cache.SetCacheability(HttpCacheability.NoCache)
I am exploring a way to get rid of this issue since three days.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home