If you ever have a need to delete or expire a Cookie that you create through ASP.NET or ASP.NET MVC, fortunately, MSDN has just an article on how to accomplish that!
https://msdn.microsoft.com/en-us/library/ms178195.aspx
Pretty simple, right??
https://msdn.microsoft.com/en-us/library/ms178195.aspx
if (Request.Cookies["UserSettings"] != null) { HttpCookie myCookie = new HttpCookie("UserSettings"); myCookie.Expires = DateTime.Now.AddDays(-1d); Response.Cookies.Add(myCookie); }
Pretty simple, right??
No comments:
Post a Comment