public override void Process(HttpRequestArgs args) { try { var guidString = args.Context.Request.Form["__PARAMETERS"]; if (guidString != null) { int guidStart = guidString.IndexOf('"') + 1; int guidStop = guidString.LastIndexOf('"'); if (guidStart != -1 && guidStop > guidStart) { guidString = guidString.Substring(guidStart, guidStop - guidStart); HttpCookie myCookie = args.Context.Request.Cookies["scseditorcontext" + Regex.Replace(Context.GetUserName(), "[^a-zA-Z0-9 -]", string.Empty)]; if (!_sitecoreDataAccessService.TryGetItemData(guidString, out IItemData item)) { return; } if (item != null) { SessionStateSection SessionSettings = (SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState"); EditingContextRegistration.Related[HttpContext.Current.Request.Cookies[SessionSettings.CookieName]?.Value ?? ""] = _sitecoreDataAccessService.GetItemReferences(item).Select(x => new TypeContentTreeNode(x)).OrderBy(x => x.DisplayName).ToList(); EditingContextRegistration.Referrers[HttpContext.Current.Request.Cookies[SessionSettings.CookieName]?.Value ?? ""] = _sitecoreDataAccessService.GetItemReferrers(item).Select(x => new TypeContentTreeNode(x)).OrderBy(x => x.DisplayName).ToList(); } ContentTreeNode current = new ContentTreeNode(item, false); if (string.IsNullOrWhiteSpace(current.DisplayName)) { return; } if (myCookie?.Value != null) { var list = GetValue(myCookie, current.Id); list.Add($"{current.Id}|{current.DatabaseName}"); if (list.Count > 10) { list.RemoveAt(0); } SetValue(myCookie, string.Join(",", list)); args.Context.Response.Cookies.Add(myCookie); } else { myCookie = new HttpCookie("scseditorcontext" + Regex.Replace(Context.GetUserName(), "[^a-zA-Z0-9 -]", string.Empty)); SetValue(myCookie, $"{current.Id}|{current.DatabaseName}"); myCookie.Expires = DateTime.Now.AddDays(1d); args.Context.Response.Cookies.Add(myCookie); } } } } catch (Exception e) { Log.Warn("unable to register action for SCS Editing Context", e, this); } }