I have a series of cookies
and sessions
which are created at the time of login in a successful way in an application. My question is how can I eliminate these cookies
and session
created at the time of logout?
I have the following in a controller:
CookieService.SetCookie(model.mipropiedad, "cookie1"); // se encarga de crear una cookie de nombre cookie1 con el dato que le paso desde mi modelo.
CookieService.SetCookie(model.mipropiedad2, "cookie2");
Session["MiSession"] = model.mipropiedad3
Will it be correct to delete these cookies in the following way?
public static void LogOut()
{
var mivar = new HttpCookie("cookie1");
CookieSession.Expires = DateTime.Now.AddDays(-1);
CookieSession.Value = string.Empty;
HttpContext.Current.Response.Cookies.Add(mivar);
}
If this is the case, only 1 cookie with the name cookie1 would be deleting, but how do I delete the others together with the session?