Clear System Cache and Temp values using Asp.net

Posted by Raja_89 under C# on 2/14/2017 | Points: 10 | Views : 1373 | Status : [Member] | Replies : 1
Hai

Is it possible to clean the cache and temp values programatically using Asp.net C# when button was fired.

Thanks.




Responses

Posted by: A2H on: 2/14/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
You can clear the cache items like given below

 protected void Button1_Click(object sender, EventArgs e)
{
//Loop thorough items in cahce
foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache)
{
//Clear the items one by one
HttpContext.Current.Cache.Remove((string)entry.Key);
}
}


Thanks,
A2H
My Blog

Raja_89, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response