Possible Duplicate:
Delete cookie on clicking sign out
I want to delete cookies when the user logout.
Here is my code:
if (HttpContext.Current.Request.Cookies["currentUser"] != null)
{
DeleteCookie(HttpContext.Current.Request.Cookies["currentUser"]);
}
public void DeleteCookie(HttpCookie httpCookie)
{
try
{
httpCookie.Value = null;
httpCookie.Expires = DateTime.Now.AddMinutes(-20);
HttpContext.Current.Request.Cookies.Add(httpCookie);
}
catch (Exception ex)
{
throw (ex);
}
}
But it doesn't work. Do you have any suggestion?