/// <summary> /// Hide or show the banner depending on user preference. /// </summary> private void ShowBanner() { if (Request.IsAuthenticated == true) { ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); // Retrieve the account information from the account controller AccountInfo myAccount = accountController.GetAccountInfo(false); if (myAccount != null) { areaBanner.Visible = myAccount.IsShowBanners; string categoryKey = myAccount.Category; string bannerKey = "Banner" + categoryKey; string bannerPath = ""; if (Cache[bannerKey] != null) { // If the data is already cached, then used the cached copy bannerPath = ((string)Cache[bannerKey]); } else { // If the data is not cached, then create a new profile object object and request the data ProfileBO profile = new ProfileBO(); bannerPath = profile.GetBannerPath(categoryKey); // Store the results of the call in the Cache and set the time out to 6 hours Cache.Add(bannerKey, bannerPath, null, DateTime.Now.AddHours(6), Cache.NoSlidingExpiration, CacheItemPriority.High, null); } areaImage.InnerHtml = bannerPath; } } }