Clear all cookies in Asp.net Core

Viewed 28032

I'm working on a Asp.net Core website , and in my logout link I want to remove all current domain cookies. when I was work with Asp.net MVC I tried this code

string[] myCookies = Request.Cookies.AllKeys;
foreach (string cookie in myCookies)
{
  Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);
}

this code doesn't work in Asp.net Core. How can I clear all cookies in Asp.net Core?

2 Answers
Related