the session cookie, like the authentication cookie uses encryption. your servers need to use the same key. in 4.8 you specified the same key in the web.config (machine key). with .net core, the key is always generated, so you need to define a common Store for Data Protection Services:
ASP.NET state service isn’t working in .NET6
We’ve used the ASP.NET state service to handle sessions of our two webservers behind the loadbalancer. After changing .net6 it seems that this function isn’t working anymore. What is the solution in .NET6 to handle these sessions properly?
Developer technologies ASP.NET ASP.NET Core
Developer technologies C#
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2022-07-26T15:35:38.427+00:00
2 additional answers
Sort by: Most helpful
-
Sreeju Nair 12,666 Reputation points
2022-07-25T09:40:31.787+00:00 ASP.Net Core support Session State. Refer the below documentation
Hope this helps
-
Rameil, Eric 21 Reputation points
2022-07-25T11:16:15.96+00:00 Thanks for your answer.
To make it more clear:We migrated a .NET 4.8 WebProject to .NET 6, we are using for authification with Entity Framwork, MySQL database as database and the webserver is hosted on IIS 10. The login is not saved anymore between the two webservers. Before we used the ASP.NET State Service for exchange the session of login between both webservers. Therefor we added the necessary configs to the WebConfig file, this file is not longer existing in .NET 6 projects.
We allready read the documentation you have given. We tried to use the MSSQL Server as distributed cache, for manually setting session variables this worked fine, but the login is still not possible with the distributed sql server.