Reputation: 639
My localhost application is losing all session values after a postback from the application that handles the authentication for us.
When I deploy the application on my development server that has the same domain as the authentication application, the session values are kept.
I've checked all the settings related for the pool and the Session State on IIS and they're the same on my machine and the server.
Upvotes: 0
Views: 751
Reputation: 639
My problem was related to the SameSite Cookie changes that happened in 2019.
Adding this to the <system.web> section of the web.config solved the problem:
<httpCookies sameSite="None" requireSSL="true"/>
<authentication>
<forms cookieSameSite="None" requireSSL="true" />
</authentication>
<sessionState cookieSameSite="None"/>
More information on SameSite Cookies here:
https://learn.microsoft.com/en-us/aspnet/samesite/system-web-samesite
Upvotes: 1