I am trying to delete some cookie that javascript set, it works well in Firefox and Chrome, but not in IE, it deletes the cookie value in IE, but not the file, so when I load a page that uses cookie, it loads some junk instead of nothing after removal.
I set the cookie as follows
var exdate = new Date(); exdate.setDate(exdate.getDate() + 1); var c_value = escape(data.d) + "; expires=" + exdate.toUTCString(); document.cookie = "user" + "=" + data.d;
and delete it like this:
document.cookie = 'user=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
where is my problem
I also have code in C # for ASP.Net to delete a cookie, but it doesnβt work in any of the web browsers (it works for a cookie that was set by C #, but not with Javascript), where there is a problem with this code ?
FormsAuthentication.SignOut(); Response.Cookies["user"].Expires = DateTime.Now.AddDays(-1); Session.Clear(); Response.Cookies.Clear();
source share