Remove cookies from browser... Using C# code..
Below is code where you can
delete all cookies :
void Page_Load()
{
string[]
cookies =
Request.Cookies.
AllKeys;
foreach
(string cookie in
cookies)
{
BulletedList1.Items
.Add("Deleting " +
cookie);
Response.Cookies
[cookie].Expires =
DateTime.Now.AddDays
(-1);
}
}
for more detail about
cookies : http://
msdn.microsoft.com/en-us/
library/ms178194.aspx
Helper based on http://
msdn.microsoft.com/en-us/
library/ms178195.aspx :
public static void
DeleteCookie(
HttpRequest
request,
HttpResponse
response, string
name)
{
if
(request.Cookies
[name] == null)
return;
var cookie = new
HttpCookie(name)
{Expires =
DateTime.Now.AddDays
(-1d)};
response.Cookies.Add
(cookie);
}
try these...
Comments
Post a Comment