How do I clear the server cache in asp.net? I have found out that there are two kinds of the cache. There is the browser cache and the server cache. I have done some searching but I have yet to find a clear, step-by-step guide for clearing the server cache using asp.net (or not).
(update) I just learned that the code-behind for this is in VB - Visual Basic (dot net).
When the service has stopped, go to the following locations and delete any folders under the folder of root (. NET cache) leaving the root folder alone: C:\Windows\Microsoft.NET\Framework\v2. 0.50727\Temporary ASP.NET Files\root.
The cached data is stored in server memory. Class Caching : Web pages or web services are compiled into a page class in the assembly, when run for the first time. Then the assembly is cached in the server. Next time when a request is made for the page or service, the cached assembly is referred to.
You could loop through all the cache items and delete them one by one:
foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache){ HttpContext.Current.Cache.Remove(string(entry.Key)); }
Syntax Correction for ASP.NET 4.5 C#
foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache){ HttpContext.Current.Cache.Remove((string)entry.Key); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With