Skip to content

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

Open
@tsi-kyle

Description

@tsi-kyle

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:

  • MVC
  • .NET Framework Version: 4.7.2
  • IIS Version:
  • Windows Version: 11

ASP.NET Core Application:

  • Targeted .NET version: .NET 8
  • .NET SDK version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIssues that have a PR open for them.Needs: Triage 🔍Label added to new issues which need Triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions