Hi, I've tried several combinations of commands like the following to finish a session:

Request.Cookies.Remove("cookie1");
Request.Cookies.Remove("cookie2");
Request.Cookies.Clear();
        
Response.Cookies.Remove("cookie1");
Response.Cookies.Remove("cooke2");
Response.Cookies.Clear();

But after that I go to another page that checks for the existence of the cookies, and it still finds them.

Any ideas?

Thanks in advance.

Are you sure the page isn't cached? If the page is cached, then it isn't finding the cookies, just using the settings on when they found them in the past.

It was cached actually, but I've added the

Response.AddHeader("cache-control", "no-cache");

line to avoid caching and it was still the same.

Finally I set the expiration date of the cookie to -1 and it's working now.

Thanks.

if (Request.Cookies["UserSettings"] != null)
 {
HttpCookie myCookie = new HttpCookie("UserSettings");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);
 }

this code is working fine for delete cookies

This question has already been answered. Start a new discussion instead.