diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs index a30ddb5dc9..19bb9c34e5 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs @@ -568,6 +568,7 @@ internal HttpSessionState() { } public bool IsReadOnly { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public bool IsSynchronized { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public object this[string name] { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} set { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } + public System.Web.SessionState.SessionStateMode Mode { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string SessionID { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public object SyncRoot { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public int Timeout { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} set { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } @@ -579,4 +580,12 @@ internal HttpSessionState() { } public void Remove(string name) { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} public void RemoveAll() { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } + public enum SessionStateMode + { + Custom = 4, + InProc = 1, + Off = 0, + SQLServer = 3, + StateServer = 2, + } } diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/TypeForwards.Framework.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/TypeForwards.Framework.cs index 3ae6c697cd..11947fae26 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/TypeForwards.Framework.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/TypeForwards.Framework.cs @@ -53,3 +53,4 @@ [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Web.Caching.CacheItemUpdateReason))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Web.Configuration.HttpCapabilitiesBase))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Web.SessionState.HttpSessionState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Web.SessionState.SessionStateMode))] diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/HttpSessionState.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/HttpSessionState.cs index afcb50ba48..18219c0d95 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/HttpSessionState.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/HttpSessionState.cs @@ -35,6 +35,9 @@ public int Timeout public object SyncRoot => _container.SyncRoot; + [Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = Constants.ApiFromAspNet)] + public SessionStateMode Mode => SessionStateMode.Custom; + public void Abandon() => _container.IsAbandoned = true; public object? this[string name] diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/SessionStateMode.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/SessionStateMode.cs new file mode 100644 index 0000000000..2e60b391c8 --- /dev/null +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/SessionState/SessionStateMode.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Web.SessionState; + +public enum SessionStateMode +{ + Off = 0, + InProc = 1, + StateServer = 2, + SQLServer = 3, + Custom = 4 +}; diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/SessionState/HttpSessionStateTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/SessionState/HttpSessionStateTests.cs index 4942b5f39c..408983d6c9 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/SessionState/HttpSessionStateTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/SessionState/HttpSessionStateTests.cs @@ -36,6 +36,21 @@ public void SessionId() Assert.Equal(id, result); } + [Fact] + public void Mode() + { + // Arrange + var session = new Mock(); + + var state = new HttpSessionState(session.Object); + + // Act + var result = state.Mode; + + // Assert + Assert.Equal(SessionStateMode.Custom, result); + } + [Fact] public void Count() {