ASP.NET Core storage session to get any value

The project is a mvc project, I use the session to store user login information, and then find the login information is stored in the normal session, this time also flew to acquire normal

But if I jump to the home page, go get session information, discovery session is null, and so on through Baidu to find information, find out the cause of this situation is due to the influence of CookiePolicy

Need to comment startup inside

            //services.Configure<CookiePolicyOptions>(options =>
            //{
            //    options.CheckConsentNeeded = context => true;
            //    options.MinimumSameSitePolicy = SameSiteMode.None;
            //});

There configure inside

app.UseCookiePolicy();
After the rebuild the run project found that normal use  

Guess you like

Origin www.cnblogs.com/ITzhangyunpeng/p/12527522.html