Wednesday, June 3, 2009

Delete Cookies thru C#


Following code explain, how to Delete all the cookies thru C#. this code lists the deleted cookie details in a ListBox control.

string[] cookies = Request.Cookies.AllKeys;

foreach (string cookie in cookies)


// this code Adding deleted cookies details in Listbox

ListBox1.Items.Add("Deleting " + cookie);

Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);


Hope it helps you, leave your valuable comments

No comments:

Post a Comment