Ok, so I really think I am doing this right, but the cookies aren\'t being cleared.
Session.Clear();
HttpCookie c = Request.Cookies[\"MyCookie\"];
if (c !
I did this and it worked for clearing (not deleting) a session cookie:
HttpContext.Response.Cookies.Set(new HttpCookie("cookie_name"){Value = string.Empty});
Based on Metro's response I created this extension method to make the code reusable in any controller.
///
/// Deletes a cookie with specified name
///
/// extends the controller
/// cookie name
public static void DeleteCookie(this Controller controller, string cookieName)
{
if (controller.HttpContext.Request.Cookies[cookieName] == null)
return; //cookie doesn't exist
var c = new HttpCookie(cookieName)
{
Expires = DateTime.Now.AddDays(-1)
};
controller.HttpContext.Response.Cookies.Add(c);
}