I am building a simple Blazor Server-side App. I followed the steps mentioned in the
Before this, I can see a warning that says that the cookie has set SameSite=None and so it must set ‘Secure’.
I have since then tried multiple changes in the Program.cs to handle this but none of the settings worked.
Things that I have tried -
Adding the following setting -
builder.Services.ConfigureApplicationCookie(options => { options.Cookie.SameSite = SameSiteMode.None;});
Adding a custom class to handle this situation as suggested in the blog - Thinktecture Both these work fine in localhost debug mode but give same error as above when deployed to local IIS.
And I have not enabled https redirect.
Any help to sort this out is very much appreciated!
CodePudding user response:
What worked for me -
Enabled Https binding on IIS - IIS - Https Binding
Enabling https redirection in Program.cs
Adding https port in appsettings.json
CodePudding user response:
I follow the blog you provided and I also find this issue. I have try a lot of method to solve it, but failed.
And I find sentence. Please note: The setting SameSite=None will only work if the cookie is also marked as Secure and requires a HTTPS connection.
So the first method will not work.
After deployed the project and I find it works in IE, but not in Chrome or Edge. So I think it's not the code issue, it related with Broswer.
And the bad new is, we can't find Google Chrome 'SameSite by default cookies' and 'Cookies without SameSite must be secure' flags taken away after update v91.
Workaround
Use Https
Use IE