diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs
index 7e5eb8f90..a61a8d5ab 100644
--- a/Emby.Dlna/Api/DlnaServerService.cs
+++ b/Emby.Dlna/Api/DlnaServerService.cs
@@ -134,8 +134,7 @@ namespace Emby.Dlna.Api
_dlnaManager = dlnaManager;
_resultFactory = httpResultFactory;
_configurationManager = configurationManager;
- object request = httpContextAccessor?.HttpContext.Items["ServiceStackRequest"] ?? throw new ArgumentNullException(nameof(httpContextAccessor));
- Request = (IRequest)request;
+ Request = httpContextAccessor?.HttpContext.GetServiceStack() ?? throw new ArgumentNullException(nameof(httpContextAccessor));
}
private string GetHeader(string name)
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index 3997a5ddb..3d4e1ca77 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -6,6 +6,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
diff --git a/Emby.Server.Implementations/Services/HttpContextExtension.cs b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs
similarity index 68%
rename from Emby.Server.Implementations/Services/HttpContextExtension.cs
rename to MediaBrowser.Common/Extensions/HttpContextExtensions.cs
index 6d3a600ab..4bab42cc1 100644
--- a/Emby.Server.Implementations/Services/HttpContextExtension.cs
+++ b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs
@@ -1,27 +1,28 @@
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
-namespace Emby.Server.Implementations.Services
+namespace MediaBrowser.Common.Extensions
{
///
/// Extention to enable the service stack request to be stored in the HttpRequest object.
+ /// Static class containing extension methods for .
///
- public static class HttpContextExtension
+ public static class HttpContextExtensions
{
- private const string SERVICESTACKREQUEST = "ServiceRequestStack";
+ private const string SERVICESTACKREQUEST = "ServiceStackRequest";
///
- /// Set the service stack request.
+ /// Set the ServiceStack request.
///
/// The HttpContext instance.
- /// The IRequest instance.
+ /// The service stack request instance.
public static void SetServiceStackRequest(this HttpContext httpContext, IRequest request)
{
httpContext.Items[SERVICESTACKREQUEST] = request;
}
///
- /// Get the service stack request.
+ /// Get the ServiceStack request.
///
/// The HttpContext instance.
/// The service stack request instance.