Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have stored a value in a key and cached it(using HttpRunTime.Cache.Insert) for a specific period of time(say 20 mins). Now I want to clear the cache whenever the cache is cleared from the browser the user. How do I do it(what code do I need to write on the server side for that)?

What I have tried:

I have tried HttpRunTime.Cache caching and HttpContext.Current.Caching but the cache only gets cleared after the amount of time provided in time out and not when user clears the browser cache. Please suggest me an alternate as I am new to ASP.Net caching
Posted
Updated 14-Jun-16 23:44pm
v3

1 solution

The server doesn't know when the user clears their cache so you can't react to it. You might have to do something like put a link to a handler on every page, and have it process the "If-Modified-Since" header. If that header is empty then this is the first time the user has requested the url so you could assume it is their first hit, or that they have cleared their cache, and clear the server-side data at that point if it exists.
 
Share this answer
 
Comments
Member 11990968 15-Jun-16 6:15am    
By handler, do you mean Http Handler? If not, can you please specify what kind of handler?
F-ES Sitecore 15-Jun-16 6:49am    
an ashx handler.

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