mardi 6 octobre 2020

Delete chrome cache programatically

I am trying to delete Chrome browser cache on logout of an application. I am using below set of code inside logout button click event and it doesn't clear browser cache.

HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();

I also have placed the below meta tags in cshtml page and didn't help. Really appreciate any suggestions.

<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">



Aucun commentaire:

Enregistrer un commentaire