diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5dd9846a73..c155d760ae 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -26,6 +26,7 @@
+
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
index 88b4506dc5..782fa65241 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
+++ b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
@@ -30,6 +30,7 @@
+
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs
index 3c44cda4e3..13b5ab070c 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/HttpContextWebClientInfoProvider.cs
@@ -1,4 +1,5 @@
using System;
+using DeviceDetectorNET;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
@@ -22,6 +23,8 @@ public class HttpContextWebClientInfoProvider : IWebClientInfoProvider, ITransie
public string? ClientIpAddress => GetClientIpAddress();
+ public string? DeviceInfo => GetDeviceInfo();
+
protected virtual string? GetBrowserInfo()
{
return HttpContextAccessor.HttpContext?.Request?.Headers?["User-Agent"];
@@ -39,4 +42,30 @@ public class HttpContextWebClientInfoProvider : IWebClientInfoProvider, ITransie
return null;
}
}
+
+ protected virtual string? GetDeviceInfo()
+ {
+ string? deviceInfo = null;
+ var deviceDetector = new DeviceDetector(GetBrowserInfo());
+ deviceDetector.Parse();
+ if (!deviceDetector.IsParsed())
+ {
+ return deviceInfo;
+ }
+
+ var osInfo = deviceDetector.GetOs();
+ if (osInfo.Success)
+ {
+ deviceInfo = osInfo.Match.Name;
+ }
+
+ var clientInfo = deviceDetector.GetClient();
+ if (clientInfo.Success)
+ {
+ deviceInfo = deviceInfo.IsNullOrWhiteSpace() ? clientInfo.Match.Name : deviceInfo + " " + clientInfo.Match.Name;
+ }
+
+ return deviceInfo;
+ }
+
}
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs
index abd92597d3..7cbb4ecae8 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/WebClientInfo/IWebClientInfoProvider.cs
@@ -5,4 +5,6 @@ public interface IWebClientInfoProvider
string? BrowserInfo { get; }
string? ClientIpAddress { get; }
+
+ string? DeviceInfo { get; }
}