Introduction:
In this article,i am going to explain about how to delete all the cookies in particular machine using asp.net
Main:
Sometimes in secure webpages,we need to clear all client side entries.The below server side code will clear all cookie entries.
string[] Cookentries = Request.Cookies.AllKeys;
foreach (string local_cookie in Cookentries)
{
Response.Cookies[local_cookie].Expires = DateTime.Now.AddDays(-1);
}
string[] Cookentries = Request.Cookies.AllKeys; foreach (string local_cookie in Cookentries) { Response.Cookies[local_cookie].Expires = DateTime.Now.AddDays(-1); } |
Conclusion:
Hope this helps,
Happy Coding.