How to clear the cookie information in c#?

Forums .NETHow to clear the cookie information in c#?
Staff asked 3 years ago

Answers (1)

Add Answer
Staff answered 3 years 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