I have two projects:
- ASP.NET webforms (.NET 4.8)
- ASP.NET Core Web API (.NET 6.0)
There are many session values which are used by the ASP.NET webforms app. Since the ASP.NET Core Web API application would be running side-by-side, I need to access these session values in the .NET Core project, too.
I followed the instruction given in
Session sharing between Asp.Net Webforms and Asp.Net Core
but I got Null
values in the .NET Core Web API project every time.
Here is my code snippet for the ASP.NET application
Web.config
:
I have installed Microsoft.AspNetCore.SystemWebAdapters
and Microsoft.AspNet.SessionState
:
Global.asax
:
Setting a session value:
Changes made to the ASP.NET Core Web API:
Program.cs
:
appsettings.json
:
Code to retrieve the session value:
Let me know if I am missing anything here.
Thanks in advance