diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeNotificationsController.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeNotificationsController.cs
new file mode 100644
index 0000000000..d84c3f9253
--- /dev/null
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeNotificationsController.cs
@@ -0,0 +1,16 @@
+using Microsoft.AspNetCore.Mvc;
+using Umbraco.Web.WebApi.Filters;
+
+namespace Umbraco.Web.Editors
+{
+ ///
+ /// An abstract controller that automatically checks if any request is a non-GET and if the
+ /// resulting message is INotificationModel in which case it will append any Event Messages
+ /// currently in the request.
+ ///
+ [TypeFilter(typeof(AppendCurrentEventMessagesAttribute))]
+ public abstract class BackOfficeNotificationsController : UmbracoAuthorizedJsonController
+ {
+
+ }
+}
diff --git a/src/Umbraco.Web/WebApi/Filters/AppendCurrentEventMessagesAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/AppendCurrentEventMessagesAttribute.cs
similarity index 65%
rename from src/Umbraco.Web/WebApi/Filters/AppendCurrentEventMessagesAttribute.cs
rename to src/Umbraco.Web.BackOffice/Filters/AppendCurrentEventMessagesAttribute.cs
index 949d5daced..60a4ae375f 100644
--- a/src/Umbraco.Web/WebApi/Filters/AppendCurrentEventMessagesAttribute.cs
+++ b/src/Umbraco.Web.BackOffice/Filters/AppendCurrentEventMessagesAttribute.cs
@@ -1,8 +1,8 @@
using System;
using System.Net.Http;
-using System.Web.Http.Filters;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
using Umbraco.Core.Events;
-using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.WebApi.Filters
@@ -14,19 +14,28 @@ namespace Umbraco.Web.WebApi.Filters
///
internal sealed class AppendCurrentEventMessagesAttribute : ActionFilterAttribute
{
- public override void OnActionExecuted(HttpActionExecutedContext context)
- {
- if (context.Response == null) return;
- if (context.Request.Method == HttpMethod.Get) return;
- if (Current.UmbracoContext == null) return;
+ private readonly IUmbracoContextAccessor _umbracoContextAccessor;
+ private readonly IEventMessagesFactory _eventMessagesFactory;
- var obj = context.Response.Content as ObjectContent;
- if (obj == null) return;
+ public AppendCurrentEventMessagesAttribute(IUmbracoContextAccessor umbracoContextAccessor, IEventMessagesFactory eventMessagesFactory)
+ {
+ _umbracoContextAccessor = umbracoContextAccessor;
+ _eventMessagesFactory = eventMessagesFactory;
+ }
+
+ public override void OnActionExecuted(ActionExecutedContext context)
+ {
+ if (context.HttpContext.Response == null) return;
+ if (context.HttpContext.Request.Method.Equals(HttpMethod.Get.ToString(), StringComparison.InvariantCultureIgnoreCase)) return;
+ var umbracoContext = _umbracoContextAccessor.UmbracoContext;
+ if (umbracoContext == null) return;
+
+ if(!(context.Result is ObjectResult obj)) return;
var notifications = obj.Value as INotificationModel;
if (notifications == null) return;
- var msgs = Current.EventMessages;
+ var msgs = _eventMessagesFactory.GetOrDefault();
if (msgs == null) return;
foreach (var eventMessage in msgs.GetAll())
diff --git a/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs b/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
index fe9e82c580..b4a71a8840 100644
--- a/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
@@ -17,7 +17,7 @@ namespace Umbraco.Web.Editors
/// resulting message is INotificationModel in which case it will append any Event Messages
/// currently in the request.
///
- [AppendCurrentEventMessages]
+ //[AppendCurrentEventMessages] // Moved to netcore
[PrefixlessBodyModelValidator]
public abstract class BackOfficeNotificationsController : UmbracoAuthorizedJsonController
{
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 2db3dcd909..c747d5f19b 100755
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -390,7 +390,6 @@
-