-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add example compatible with sessions #8
Comments
Hello, Well I think is not about the compatible session example, but the session is always null, because OnStarting in SessionMiddleware never triggered. the OnStarting is responsible for sending session to cookie. My Startup.cs ---Configure -- > HttpContext.Session.SetString("hi", "Hello world"); --> doesn't work , because "Session" never sent to cookie by SessionMiddleware. So I find out. SessionMiddleware uses OnStarting to write session cookies, but it's never triggered by the owin server I think All middleware that implements OnStarting/OnComplete is never triggered by owin server. (my oppinion about the flow, OnStarting/OnComplete Triggerd by StartAsync, StartAsync Triggered by RequestDelegate, since it use Owin, StartAsync must be called manually on the server, if I'am not wrong). so I checked implementation of IHttpResponseFeature, I found the IHttpResponseFeature.OnStarting is empty, it should be implemented. OwinFeatureImpl.cs` public class OwinFeatureImpl : IHttpRequestFeature, IHttpResponseFeature, IHttpResponseBodyFeature, IHttpRequestIdentifierFeature, IOwinEnvironmentFeature { ////// Gets or sets OWIN environment values. ///public IDictionary Environment { get; set; } private PipeWriter _responseBodyWrapper; private IHeaderDictionary _requestHeaders; private IHeaderDictionary _responseHeaders;
` OwinServer.cs` public class OwinServer : IServer { private IFeatureCollection _features = new FeatureCollection(); private Action useOwin;
` and now my session are working, tested with chromly and webview2 sample I hope this help if someone have the same issue with "onstarting middleware" especialy SessionMiddleware(UseSession). Thanks. |
@marman-hp Thanks for posting your findings 👍 Can you please submit your changes as a |
I have create fork from your repository , and make minor changes, added missing ability with IHttpResponseFeature, so that anyone can test or investigate the code. |
Consider adding an example that is compatible with server code that uses a session and session cookie.
The text was updated successfully, but these errors were encountered: