dotnet / systemweb-adapters

MIT License
338 stars 60 forks source link

JsonSessionSerializerOptions keys case sensitive #536

Closed arnoj closed 1 month ago

arnoj commented 2 months ago

Describe the bug

Is there a reason the JSON session serializer options has a case sensitive dictionary of known session keys?

I believe the default for .NET has been case insensitive for a long time. Especially in the state sharing use case this might be confusing why values are null if the key isn't exactly the same. If this was chosen on purpose it might be an idea to call this out in documentation for clarity?

https://github.com/dotnet/systemweb-adapters/blob/447194bb2fec008473133fb597958e2e77d21945/src/Microsoft.AspNetCore.SystemWebAdapters.Abstractions/SessionState/Serialization/JsonSessionSerializerOptions.cs#L17

joperezr commented 2 months ago

I don't believe there is a specific reason. Would you be willing to contribute a PR with the change along with a Comparer on the options?

twsouthwick commented 1 month ago

This has been merged. Thanks @arnoj for the fix!