Skip to content

add support for context.SetSessionStateBehavior #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 16, 2023
Merged

Conversation

Clounea
Copy link
Contributor

@Clounea Clounea commented Sep 5, 2023

close #371

I don't know if I could change the metadata. Comments are welcome.

And I don't find a good place to add tests. It seems that I need a web app and a beginrequesthandler where I could setsessionstatebehavior.

Copy link
Member

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try combining the existing endpoint into the new session feature?

@twsouthwick
Copy link
Member

@Clounea Thanks for working on this. I've looked into the question you had about the exception and it appears to have been caused by trying to commit a readonly session. I've fixed that. I've also pushed a few changes to clean up the tests to use xunit theories, as well as integrating in some changes from main that affect how we're structuring features.

@@ -2,13 +2,51 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Web.SessionState;

namespace Microsoft.AspNetCore.SystemWebAdapters;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SessionAttribute : Attribute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Clounea could you add some tests for this? other than that, I'm good with these changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I could. I will also add tests for overriding scenario

Copy link
Member

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some nullability issues - make sure when you compile locally that there are no compile warnings (ide warnings are not an issue). If you do dotnet build locally and see warnings, those are the ones that turn in errors on CI

@twsouthwick twsouthwick enabled auto-merge (squash) October 16, 2023 16:08
@twsouthwick
Copy link
Member

@Clounea LGTM! Thanks for iterating on this

@twsouthwick twsouthwick merged commit cb78246 into dotnet:main Oct 16, 2023
twsouthwick added a commit that referenced this pull request Jan 9, 2024
As part of expanding the session support to enable per request changing the session behavior in #399, it appears that the default `SessionAttribute` was changed to have a different default value.

Fixes #455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ask About HttpContext.SetSessionStateBehavior
2 participants