Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

asp.net core - How can I solve same site attribute problem in Chrome80?

My website developed by asp.net core 5

The website has added a third-party js package for statistics(Something like Google Analytics).

However, chrome now report these:

Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute
Because a cookie’s SameSite attribute was not set or is invalid, it defaults to SameSite=Lax, which prevents the cookie from being sent in a cross-site request. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery.
Resolve this issue by updating the attributes of the cookie:
Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use.
Specify SameSite=Strict or SameSite=Lax if the cookie should not be sent in cross-site requests.
23 cookies
9 requests

I only found a tutorial about this by adding this code in ConfigureServices:

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

However, it doesn't work any. Chrome still reports the error.

How can I solve this? Thank you.

===================================

Here is the cookies-page in DevTools of Chrome: enter image description here

The red block is my website and the other is the third-party js package.

question from:https://stackoverflow.com/questions/65935889/how-can-i-solve-same-site-attribute-problem-in-chrome80

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...