I have migrated my .NET core3.0 code to .NET 6. After migration, cookies are not getting shared from mydomain.com to localhost.mydomain.com allowed domain. Below is my code to create the cookies.
var setCookieHeaderValue = new Microsoft.Net.Http.Headers.SetCookieHeaderValue("cookiename", "test")
{
Domain = ".mydomain.com",
Path = "/",
Secure = true,
HttpOnly = true
};
context.Response.Headers[Microsoft.Net.Http.Headers.HeaderNames.SetCookie] = Microsoft.Extensions.Primitives.StringValues.Concat(context.Response.Headers[Microsoft.Net.Http.Headers.HeaderNames.SetCookie], setCookieHeaderValue.ToString());
same code is working in vs2019.
I tried changing the samesite,secure and httponly properties, but no luck.
Any help would be appreciated.

Steps to Reproduce 1.copy the above code in asp.net core web app with vs20222, run it with chrome,you will find the cookie(run with the domain with localhost.mydomain.com). 2.create another asp.net core webapp in VS2022 and paste the below code to read the cookie HttpContext.Request.Cookies["cookiename"] ,run it with same domain localhost.mydomain.com , you will get the new window opened. this new window will show no cookie.