string strDate = DateTime.Now.ToString("yyyyMMdd") + context.Session["staffId"].ToString() + "branchHeader"; if (context.Cache[strDate] != null) { context.Response.Write(context.Cache[strDate].ToString()); } else { string outString = GetChartHeader(quarter); context.Cache.Insert(strDate, outString, null, DateTime.Now.AddHours(2), TimeSpan.Zero); context.Response.Write(GetChartHeader(quarter)); }