ASP.NET Core 2.1
I think this gets set automatically. How do I prevent that?
Just came across the same issue. My 100% cookie-free website had a cookie, created by ASP.NET Core
.
As @mark-g pointed out in his comment, it is mainly added to support GDPR: Let users of your web page opt-in/out for the allowance to collect and keep data about them.
In all usual cases I'd recommend to go this route as designed by Microsoft. Keep the ASP.NET cookie and make use of the _CookieConsentPartial.cshtml
for all personal data you might want to keep about the users.
In my special case, I have a very simple web page. No data is collected, also not from any third parties. I dont need the cookie consent and the ASP.NET cookie. In this case, can remove this cookie just by commenting out one line:
In Startup.cs comment out the line:
// app.UseCookiePolicy(); No cookies used at all!
Then clear all caches and remove the cookie, reload the page and it is gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With