Use `context.Response.Cookies.Delete(name)` to instruct the browser to remove a named cookie. This is a response operation: the browser stops sending the cookie on subsequent requests. Call it before writing the response body, because cookie changes are sent in response headers and later changes are ignored. section 16.2
Clear two counters
A `/cookie` endpoint reads `counter1` and `counter2` from request cookies, defaults missing values to zero, increments them, and writes them back with a 30-minute `MaxAge`. A `/clear` endpoint calls `context.Response.Cookies.Delete("counter1")` and `Delete("counter2")`, then redirects to `/`. Visit `/cookie` again to see the counters start over. section 16.2
...
app.MapGet("clear", context => {
context.Response.Cookies.Delete("counter1");
context.Response.Cookies.Delete("counter2");
context.Response.Redirect("/");
return Task.CompletedTask;
});
...
Shows the two `Delete` calls and the redirect in the `/clear` route. section 16.2
Do not confuse this with an HTTP DELETE request to an API. An API action can use DELETE to remove a database object by key; `Response.Cookies.Delete` instead changes the cookies sent to a browser. section 19.4.2 section 16.2







