Flushing client-side output cache

As the name says , how can I clear the outputcache on the client side ? I have several ajax calls that need to be cleared after the user performs certain actions.

I tried:

Response.RemoveOutputCacheItem(Url.Action("Action", "Controller"));

But that did not work.

I even tried to expire it all the time (even if that would be a bad approach):

                Response.Expires = 0;
                Response.ExpiresAbsolute = DateTime.Now.AddMinutes(-1);
                Response.AddHeader("pragma", "no-cache");
                Response.AddHeader("cache-control", "private");
                Response.CacheControl = "no-cache";

That didn't work either.

To be clear, I use OutputcacheLocation = Client. If I install it on Server, the above examples work flawlessly.

+3
source share
2 answers

axax , , , - , , . .

( no_cache):

<script type="text/javascript">
Date.prototype.getTicksUTC = function() 
{
    return Date.parse(this.toUTCString()) + this.getUTCMilliseconds();
} // End Function getTicksUTC


Date.prototype.getTicksGMT = function() 
{
    return Date.parse(this.toGMTString()) + this.getMilliseconds();
} // End Function getTicksGMT

var strURL= "http://localhost/ajax/whateverhandler.ashx?param1=value1&para2=value2&paraN=valueN&no_cache=" + new Date().getTicksUTC();
alert(strURL);

</script> 
+3

. , , .

-2

All Articles