Code Behind Page Page /Admin/ClearCache.aspx.cs (C#)
Used by Page /Admin/ClearCache.aspx (C#)
1: using System;  
2: using System.Web.Caching;  
3: using QuiznetOnline.Data;  
4: using System.Collections;  
5: using System.Web;  
6:   
7: namespace QuiznetOnline.Web.UI.Admin  
8: {  
9:     public enum Period{month,year,all}  
10:   
11:     public partial class ClearCache : System.Web.UI.Page  
12:     {  
13:         protected void Page_Load(object sender, EventArgs e)  
14:         {  
15:             DataFunctions dataFunctions = DataFunctions.GetInstance();  
16:             if (Session["Validated"] == null || (bool)Session["Validated"] == false)  
17:                 Response.Redirect("Default.aspx");  
18:         }  
19:   
20:         protected void cmdClearGoogleMaps_Click(object sender, EventArgs e)  
21:         {  
22:             foreach(Period period in Enum.GetValues(typeof(Period)))  
23:             {  
24:                 string cacheGoogleKey = "GoogleMap" + period;  
25:                 Cache.Remove(cacheGoogleKey);  
26:                 //Cache cache = (Cache)Cache[cacheGoogleKey];  
27:             }  
28:         }  
29:   
30:         protected void cmdClearAllCache_Click(object sender, EventArgs e)  
31:         {  
32:             IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator();  
33:   
34:             while (enumerator.MoveNext())  
35:             {  
36:                 HttpContext.Current.Cache.Remove(enumerator.Key.ToString());  
37:             }  
38:         }  
39:     }  
40: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.