How to delete cookie

J

Juan T. Llibre

You issue the same cookie with the .expires date set to any time in the past.

DateTime dtExp = DateTime.Now.AddDays(-1);
Response.Cookies["TheCookie"].Expires = dtExp;
 
A

ad

I know login controls of asp.net2.0 is use cookie to store the login
information.

Could this method suitable for the the cookie for login information?

Juan T. Llibre said:
You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.AddDays(-1);
Response.Cookies["TheCookie"].Expires = dtExp;




ad said:
Hi,
How can I delete the cookie in client?
 
G

Guest

ad,
All cookies are the same. If you know the name of the cookie, you can delete
it as Juan describes.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




ad said:
I know login controls of asp.net2.0 is use cookie to store the login
information.

Could this method suitable for the the cookie for login information?

Juan T. Llibre said:
You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.AddDays(-1);
Response.Cookies["TheCookie"].Expires = dtExp;




ad said:
Hi,
How can I delete the cookie in client?
 
A

ad

But I did not know the name of Login controls's cookies.
How could I delete all the cookis generated by my Web Application?


Peter Bromberg said:
ad,
All cookies are the same. If you know the name of the cookie, you can
delete
it as Juan describes.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




ad said:
I know login controls of asp.net2.0 is use cookie to store the login
information.

Could this method suitable for the the cookie for login information?

Juan T. Llibre said:
You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.AddDays(-1);
Response.Cookies["TheCookie"].Expires = dtExp;




Hi,
How can I delete the cookie in client?
 
G

Guest

Login Control just uses the settings of the Membership provider and Forms Auth.

Delete all cookies:

VB.NET:

Dim i As Integer
Dim cookieName As String
Dim limit As Integer = Request.Cookies.Count - 1
For i = 0 To limit
aCookie = Request.Cookies(i)
aCookie.Expires = DateTime.Now.AddDays(-1)
Response.Cookies.Add(aCookie)
Next


C#:

private int i;
private string cookieName;
private int limit = Request.Cookies.Count - 1;
for (i = 0; i <= limit; i++)
{
aCookie = Request.Cookies;
aCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(aCookie);
}
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




ad said:
But I did not know the name of Login controls's cookies.
How could I delete all the cookis generated by my Web Application?


Peter Bromberg said:
ad,
All cookies are the same. If you know the name of the cookie, you can
delete
it as Juan describes.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




ad said:
I know login controls of asp.net2.0 is use cookie to store the login
information.

Could this method suitable for the the cookie for login information?

"Juan T. Llibre" <[email protected]> ???gco?l¢Do¡Ps?D:[email protected]...

You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.AddDays(-1);
Response.Cookies["TheCookie"].Expires = dtExp;




Hi,
How can I delete the cookie in client?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top