-
Notifications
You must be signed in to change notification settings - Fork 61
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
Sharing Session between .NET Framework application and .Net7 application is not working #453
Comments
I have got something the same but under .Net 8. One thing I see this github project refers 1.2.0 version. It is possible the 1.3.0 has changed initialization steps or just moved to other place. So for now, I just downgraded the SystemWebAdapters packages back to 1.2.0 version. Confirmed the Session sharing works fine under .Net 8 in this case. |
@sgarnovsky I've tried with all versions .Net6,7,8. Its not at all working, Can you pls share your code ? |
My code is here. It's mostly the same as yours above. I only use a custom session serializer. services.AddSystemWebAdapters() app.MapRazorPages() |
@sgarnovsky I did same but somehow still System.Web.HttpContext.Current.Session is null. Any Possibilities if you can share your code in Github? |
Unfortunately, I can't share my code (it is a big customer project). Also, do not forget to apply a middleware initialization call: app.UseSystemWebAdapters(); And of course, check the session instance from the "System.Web.HttpContext": |
Dear @sgarnovsky Able to Achieve , now its working. Thankyou so much for your help. |
@lalitkhanna please post the details you found to fix on your side. |
@sgarnovsky I found couple of points for my fix.
Rest all points are same which @meghanavedpathak added. |
@lalitkhanna thank you for details. |
I tried by using .Net 6 and SystemWebAdapters using version 1.2.0 but its not working on my side. We do not want application to be on .NET 8 currently. I will check video you provided. Thank you for help. |
Same here, using .net 8 and going back to version 1.2.0 with the rest following the remoteauth identity sample works. |
Another issue, while trying to access the Asp.net web form pages then getting ERR_HTTP2_PROTOCOL_ERROR .(in console) Anybody face this issue ? |
@meghanavedpathak is this issue still relevant? |
I am trying to Set Session variable in .NET framework application and access it in .NET 7 application using link https://learn.microsoft.com/en-us/aspnet/core/migration/inc/remote-session?view=aspnetcore-7.0 however I am unable to get value of session variable in .NET Core.
I did following changes
.NET Framework -
Added Nuget package Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices
Added below code in global.asax.cs -Application_Start function
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
.AddJsonSessionSerializer(options =>
{
// Serialization/deserialization requires each session key to be registered to a type
options.RegisterKey("test");
})
// Provide a strong API key that will be used to authenticate the request on the remote app for querying the session
// ApiKey is a string representing a GUID
.AddRemoteAppServer(options => options.ApiKey = "03f74e3e-d690-4806-b0a7-e66f89215bb3")
.AddSessionServer();
.NET 7 Changes
builder.Services.AddSystemWebAdapters()
.AddJsonSessionSerializer(options =>
{
// Serialization/deserialization requires each session key to be registered to a type
options.RegisterKey("test");
}) .AddRemoteAppClient(options =>
{
// Provide the URL for the remote app that has enabled session querying
options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]);
// Provide a strong API key that will be used to authenticate the request on the remote app for querying the session
options.ApiKey = "03f74e3e-d690-4806-b0a7-e66f89215bb3";
})
.AddSessionClient();
Added app.MapDefaultControllerRoute().RequireSystemWebAdapterSession(); ;
The text was updated successfully, but these errors were encountered: