public State[] GetStateList(PetfirstCustomer mCustomer) { State[] lstReturn = null; string cacheKey = "$StateList$"; object CachedList = m_Cache.Get(cacheKey) as State[]; if (CachedList == null)//get from the service { CoreServiceReference.CoreServiceClient cs = new CoreServiceClient(); CoreServiceGetStateListResponse ccResponse = cs.GetStateList(); //insert select breed on the top if (string.IsNullOrEmpty(ccResponse.Error.ErrorText))//check error { if (ccResponse.States != null) { lstReturn = ccResponse.States; m_Cache.Add(cacheKey, lstReturn); } } else { lstReturn = null; LogException le = new LogException(); try { le.LogError(HttpContext.Current.Request.Url.AbsoluteUri, "Error during getting state list", ccResponse.Error.ErrorText, mCustomer); ///Test email server //le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", msg, "<hr />User Input:", le.BuildUserDataString(mCustomer))); } catch (Exception ex) { ///Test email server //lblError.Text = ex.ToString(); try { le.SendErrorEmail(string.Concat(HttpContext.Current.Request.Url.AbsoluteUri, "<br/><hr />", ex.Message, "<br />StackTrace: ", ex.StackTrace, "<br /><hr />User Input:", le.BuildUserDataString(mCustomer))); } catch { } } } } else { lstReturn = (State[])CachedList; } return lstReturn; }