How to clear the cookie information in c#?

Forums .NETHow to clear the cookie information in c#?
Staff asked 1 month ago

Answers (1)

Add Answer
Staff answered 1 month ago

There are two types of clear Cookie.

if (Request.Cookies["userId"] != null)
{
    Response.Cookies["userId"].Expires = DateTime.Now.AddDays(-1);   
}

 

or

 

Session.Abandon();

 

Subscribe

Select Categories