473,503 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to delete cookie

ad
Hi,
How can I delete the cookie in client?
Jun 11 '06 #1
5 7950
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;

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message news:uk**************@TK2MSFTNGP02.phx.gbl...
Hi,
How can I delete the cookie in client?


Jun 11 '06 #2
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" <no***********@nowhere.com> ¼¶¼g©ó¶l¥ó·s»D:uE**************@TK2MSFTNGP03.phx.g bl...
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;

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:uk**************@TK2MSFTNGP02.phx.gbl...
Hi,
How can I delete the cookie in client?


Jun 11 '06 #3
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" wrote:
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" <no***********@nowhere.com> ¼¶¼g©ó¶l¥ó·s»D:uE**************@TK2MSFTN GP03.phx.gbl...
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;

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:uk**************@TK2MSFTNGP02.phx.gbl...
Hi,
How can I delete the cookie in client?



Jun 12 '06 #4
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 [C# MVP]" <pb*******@yahoo.nospammin.com> ¼¶¼g©ó¶l¥ó·s»D:18********************************* *@microsoft.com...
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" wrote:
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" <no***********@nowhere.com> ???gco?l¢Do¡Ps?D:uE**************@TK2MSFTNGP03.phx .gbl...
> 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;
>
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espanol : http://asp.net.do/foros/
> ===================================
> "ad" <fl****@wfes.tcc.edu.tw> wrote in message
> news:uk**************@TK2MSFTNGP02.phx.gbl...
>> Hi,
>> How can I delete the cookie in client?
>>
>
>
>


Jun 12 '06 #5
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[i];
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" wrote:
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 [C# MVP]" <pb*******@yahoo.nospammin.com> ¼¶¼g©ó¶l¥ó·s»D:18*********************** ***********@microsoft.com...
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" wrote:
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" <no***********@nowhere.com> ???gco?l¢Do¡Ps?D:uE**************@TK2MSFTNGP03.p hx.gbl...

> 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;
>
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espanol : http://asp.net.do/foros/
> ===================================
> "ad" <fl****@wfes.tcc.edu.tw> wrote in message
> news:uk**************@TK2MSFTNGP02.phx.gbl...
>> Hi,
>> How can I delete the cookie in client?
>>
>
>
>


Jun 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4053
by: Phil Powell | last post by:
I am having this problem: My PHP script will set a cookie, it's there in my /Cookies folder. I delete the cookie (I have to for testing purposes, the PHP script I run behaves according to this...
5
1522
by: Fred | last post by:
I've check all the info I can find on cookies and I have gotten some idea of how to set a cookie, set the expiration, and get the cookie value. But I need help bringing it all together to...
9
4465
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored...
3
1834
by: Ben Amada | last post by:
Every time a user visits a particular page, I'm using the code below to add a cookie that expires in 1 day. My question is, a user may visit this page a few times within one day. Before adding...
0
319
by: Urban Bettag | last post by:
I want to use persistent cookies for my login page. For example, the user types in his username and password. He can check a box and the system should remember his username on a next visit. I have...
3
11096
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
1
2003
by: Henri | last post by:
Hi, My page saves user's login on user's computer using a cookie: Dim expires As Date = DateTime.Now.AddMonths(1) Dim cookie As New HttpCookie("login", loginValue) cookie.Expires = expires...
6
2577
by: jojowebdev | last post by:
Do javascript cookies REALLY have to be this hard? function setCookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) {...
3
2065
by: TimSki | last post by:
Hi, I have the following javascript function which creates a cookie function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays);...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.