Manually clear ASP.NET server cache for a single application/web site?

Use the following to remove all objects from the cache

IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator();

while (enumerator.MoveNext())
{

    HttpContext.Current.Cache.Remove((string)enumerator.Key);

}

Also, it is a bit of a sledgehammer option but you can restart the entire application as follows:

System.Web.HttpRuntime.UnloadAppDomain();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)