I searched and found some examples mentioning the sharing of authentication cookies between .NET Framework and .NET Core/5+ applications, but most of citations are of cookies being generated in the older version of .NET being reused in Core, not the opposite that is what I need.
share authentication cookie between .NET Framework and .Net Core
The closest case was this one.
I need my .NET Framework 4.7.2 website to be able to use the authentication of my .NET Core Website
But the version of reference is seems .NET Core 2.1 and some methods in the answer has been deprecated and I couldn't reproduce it. Also seems the authentication being performed in older application.
How could I setup a web app in ASP.NET 7 with individual accounts authentication and reuse this cookie to authorize other applications (legacy 4.x web apps modules, and also newer applications that'll be implemented)?
The middleware UseCookieAuthentication
is obsolete. Configure Cookie authentication with AddAuthentication().AddCookie
When you regist the service ,and call app.UseAuthentication()
middleware,Here's the document related
You could try as below in your .net core project and follow the case you provided
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(x =>
{
x.DataProtectionProvider = DataProtectionProvider.Create(new DirectoryInfo(.......);
}
);
.....
app.UseAuthentication()
......