Clear the ASP.Net Application Cache

I needed a quick way to clear the cache when I was debugging an issue, and couldn’t seem to find anything that worked right away online. So, created a quick foreach to handle cleaning everything up. Short and simple, thought I’d post to help anybody else out having the same issue

foreach(DictionaryEntry item in HttpContext.Current.Cache)
{
	HttpContext.Current.Cache.Remove(item.Key.ToString());
}   

HTH, thanks!

Jacob Saylor

Software developer in Kentucky

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: