public IDictionary<string, object> LoadTempData(ControllerContext controllerContext) { var cookie = controllerContext.GetCookie(UNLOCKED_TEMP_DATA_COOKIE_NAME); if (cookie == null) return new Dictionary<string, object>(3); var cookieValue = cookie.Value; if (string.IsNullOrWhiteSpace(cookieValue)) return new Dictionary<string, object>(3); var tempData = new Dictionary<string, object>(3); try { var bytes = Convert.FromBase64String(cookieValue); var data = MachineKey.Unprotect(bytes); tempData = (Dictionary<string, object>) StateBinarySerializer.Deserialize<Dictionary<string, object>>(data); if (AutoRemove) { controllerContext.ExpireCookie(UNLOCKED_TEMP_DATA_COOKIE_NAME); } } // ReSharper disable once EmptyGeneralCatchClause catch { } // Omit cookie manipulations. return tempData; }