How to clear cache items ASP.NET
This article explains how to clear cache items using C# and asp.net.
**Step 1: **Create a method for find and remove cache this method was public in any class witch use for further use in multiple places.
public void Clearcacheitems()
{
List<string> keys = new List<string>();
IDictionaryEnumerator enumerator = Cache.GetEnumerator();
while (enumerator.MoveNext())
keys.Add(enumerator.Key.ToString());
for (int i = 0; i < keys.Count; i++)
Cache.Remove(keys[i]);
}
**Step 2: **this method use in every load event method if page in master page add in only master page load event method
Clearcacheitems();
Summary
This article explained how to clear cache items using C# and asp.net