public T Get <T>(string name, HttpCookieCollection httpCookieCollection) { try { var cookieData = _cookieHelper.Get(name, httpCookieCollection); var cookieString = _encodeCookie ? _cookieHelper.Unprotect(cookieData, name) : cookieData; if (string.IsNullOrEmpty(cookieString)) { return(default(T)); } var obj = JsonConvert.DeserializeObject <T>(cookieString); return(obj); } catch { return(default(T)); } }