I am working with an asp.net (Dotnetnuke) project now. I need to change an image in a page dynamically. While clicking replace button (asp:Button
), some times the image cannot replace dynamically on the page. While pressing ctrl+F5, it will change. My question is, how to reload cache through C# code?
Another problem is that, sometimes I replace an image in a page by storing some values to database and press ctrl+F5 for making changes in the page, but while clicking ctrl+F5 there shows a dialog box with cancel or retry buttons (both on Firefox and IE). While clicking any one of them will store the same value to database. If we again refresh the page the value in the database is 3 times.
location.reload()
, but it doesn't affect browser cache. You can prevent browser cache by setting HTTP headers on your images or by requesting images using a different GET string.