From 6bbeff20a4ff75f4b038c2ccc65bca79c7ec351a Mon Sep 17 00:00:00 2001 From: martinfoster-hee Date: Wed, 12 Oct 2022 16:24:37 +0100 Subject: [PATCH 1/2] Updated typefilter to ignore Edit requests. --- .../ServiceFilter/RedirectToErrorEmptySessionData.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs index dd275f9117..b5b6fb09d5 100644 --- a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs +++ b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs @@ -34,6 +34,11 @@ public void OnActionExecuting(ActionExecutingContext context) return; } + if (context.ActionArguments["actionname"].ToString() == "Edit") + { + return; + } + if (_feature.TempDataKey != string.Empty && (controller.TempData == null || controller.TempData.Peek(_feature.TempDataKey) == null)) { context.Result = new StatusCodeResult((int)HttpStatusCode.Gone); From 6b40bbcdc2c9ad888a2a1779c7b1b5760acad6eb Mon Sep 17 00:00:00 2001 From: martinfoster-hee Date: Thu, 13 Oct 2022 09:56:37 +0100 Subject: [PATCH 2/2] Added exclusion for controllers in Edit mode. --- .../ServiceFilter/RedirectToErrorEmptySessionData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs index b5b6fb09d5..c1e71c282c 100644 --- a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs +++ b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs @@ -34,7 +34,7 @@ public void OnActionExecuting(ActionExecutingContext context) return; } - if (context.ActionArguments["actionname"].ToString() == "Edit") + if (context.ActionArguments.ContainsKey("actionname") && context.ActionArguments["actionname"].ToString() == "Edit") { return; }