Click here to Skip to main content
13,195,379 members (61,853 online)
Rate this:
Please Sign up or sign in to vote.
how to delete css, javascript file from browser cache from codebehind?
Posted 15-Jan-13 22:36pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

you can't clear the browser cache form the code behind. code behind files are executed on the server side. (Assuming your project is ASP.NET). And also, as far as I know, you can't clear browser cache using client side script such as javscript etc..

you can clear the application cache pragmatically.
$('.button').click(function() {
        url: "",
        context: document.body,
        success: function(s,x){
        $('html[manifest=saveappoffline.appcache]').attr('content', '');

or you have to disable the cache control
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>

or you have to load your files(css/images/script) as following like way

?modified=20130116044521 is a dynamic parameter just like current-time-stamp

Application cache[^]

please check the following link for more caching information[^]
Mrkraju 12-Jul-17 9:03am
?modified=20130116044521 is a dynamic parameter just like current-time-stamp

Worked for me thanks.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


You can't...

what you can do you can set expire of cache : Link[^]
Or No cache.

But you can't remove client temp file from code behind.
ashuslove 26-Nov-14 6:44am
I have ample number of the jquery in all the pages if i am going to change this manually it will take a month. If you can help me to resolve in all without coding to each page
Suvabrata Roy 29-Nov-14 14:46pm
Yes you can...
Option 1 : Write a HttpModule which will add the above code in each request.
Option 2 : Write a base class a which will derive and derived it in all other your CS page but be careful you should put your code in page unload because all developer will write some code in page load if you override it may react differently.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171019.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100