dotnet / systemweb-adapters

MIT License
332 stars 58 forks source link

Session Values are set to Null if you dont map them #503

Open tsi-kyle opened 1 month ago

tsi-kyle commented 1 month ago

Describe the bug

When using ThrowOnUnknownSessionKey = false; with the options, it allows you to ignore keys that aren't yet mapped. However, those session values are nulled out rather than ignored. I'm not sure if this is intentional, but when converting large sites a page at a time, it would make sense if there was a way to completely ignore these keys that you don't need yet.

To Reproduce

.NET Framework Side:

Configure to not throw on unknown keys and only register one key but then set 2 different keys in session: image image

.NET 8 Side:

Configure to not throw on unknown keys and only register one key, view both keys and note that only 1 is set: image image

Load the .NET Framework side again and note test2 is now null: image

Further technical details

Please include the following if applicable:

ASP.NET Framework Application:

ASP.NET Core Application: