Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i do code in ASP.NET for clear cache from browser

Some time i upload the code and our user can not see change instant so how can i do code for clear cache from browser
Posted
Comments
F-ES Sitecore 6-May-15 8:10am    
Tell them to do a hard refresh using ctrl+f5. You can't clear the browser's cache from your server code. If the issue is with css or js files you can try adding version info to the urls. The version is ignored but makes the url unique so you change it with each release, so rather than reference

somestyle.css

you reference

somestyle.css?v=1

then

somestyle.css?v=2

and so on. Same with js files.

 
Share this answer
 
use
C#
Cache.Remove("Cache_Variable_Name");
 
Share this answer
 
Refer - Cache busting in ASP.NET[^].

You need to append something to the URL of static content in order to make them new for the browser, so that browser will download the new content.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900