private ExpandoObject GetCurrentSessionValue(bool abort = false) { var tmp = HttpContext.Current.Session["demandBaseUser"]?.ToString(); dynamic data = HttpContext.Current.Items["demandbaseObject"]; if (data == null && tmp != null) { HttpContext.Current.Items["demandbaseObject"] = JsonNetWrapper.DeserializeObject <ExpandoObject>(tmp); return((ExpandoObject)HttpContext.Current.Items["demandbaseObject"]); } if (!abort && (data == null || ValidateUser.GetIpAddress() != HttpContext.Current.Session["demandBaseUserIp"]?.ToString())) { Log.Debug($"[Demandbase Debug][xdb] Demandbase data not found, going to Demandbase. {DemandbaseContext.CurrentRequestIp}"); ValidateUserData(ValidateUser.GetIpAddress()); return(GetCurrentSessionValue(true)); } return(data); }
private ExpandoObject GetCurrentSessionValue(bool abort = false) { var contact = Tracker.Current?.Contact; var tmp = contact?.GetFacet <IXdbFacetDemandbaseData>("Demandbase Data"); dynamic data = HttpContext.Current.Items["demandbaseObject"]; if (data == null && tmp?.DemandBaseData != null) { data = JsonNetWrapper.DeserializeObject <ExpandoObject>(tmp.DemandBaseData); HttpContext.Current.Items["demandbaseObject"] = data; } var dictionary = data as IDictionary <string, object>; if (!abort && (dictionary == null || tmp?.DemandBaseData == null || dictionary["ip"]?.ToString() != DemandbaseContext.CurrentRequestIp)) { Log.Debug($"[Demandbase Debug][xdb] Demandbase data not found, going to Demandbase. {DemandbaseContext.CurrentRequestIp}"); ValidateUserData(ValidateUser.GetIpAddress()); return(GetCurrentSessionValue(true)); } return(data as ExpandoObject); }