473,659 Members | 2,987 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 7959
You issue the same cookie with the .expires date set to any time in the past.

DateTime dtExp = DateTime.Now.Ad dDays(-1);
Response.Cookie s["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.tc c.edu.tw> wrote in message news:uk******** ******@TK2MSFTN GP02.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.gbl...
You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.Ad dDays(-1);
Response.Cookie s["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.tc c.edu.tw> wrote in message
news:uk******** ******@TK2MSFTN GP02.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*** ***********@TK2 MSFTNGP03.phx.g bl...
You issue the same cookie with the .expires date set to any time in the
past.

DateTime dtExp = DateTime.Now.Ad dDays(-1);
Response.Cookie s["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.tc c.edu.tw> wrote in message
news:uk******** ******@TK2MSFTN GP02.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*******@yaho o.nospammin.com > ¼¶¼g©ó¶l¥ó·s»D: 18************* *************** ******@microsof t.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*********** ***@TK2MSFTNGP0 3.phx.gbl...
> You issue the same cookie with the .expires date set to any time in the
> past.
>
> DateTime dtExp = DateTime.Now.Ad dDays(-1);
> Response.Cookie s["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.tc c.edu.tw> wrote in message
> news:uk******** ******@TK2MSFTN GP02.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.Ad dDays(-1)
Response.Cookie s.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.Ad dDays(-1);
Response.Cookie s.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*******@yaho o.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¡P s?D:uE********* *****@TK2MSFTNG P03.phx.gbl...

> You issue the same cookie with the .expires date set to any time in the
> past.
>
> DateTime dtExp = DateTime.Now.Ad dDays(-1);
> Response.Cookie s["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.tc c.edu.tw> wrote in message
> news:uk******** ******@TK2MSFTN GP02.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
4056
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 cookie existing or not) and run the script again. Everything runs fine, but the cookie is never set again. Does anyone know why this happens? I am using Win2000 Professional with IE 6. Cookies are being set with PHP and Javascript. Thanx Phil
5
1531
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 accomplish what I need to do. When someone first visits a signup page, I want them to see a popup that says they can sign up within the next 30 days without having to pay an appication fee. Then each time they revisit over the next 30
9
4487
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 in a cookie and a small bullit shown in front of the hyperlink, so when I reload the page I can immediately see which hyperlinks I already visited that day.
3
1841
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 the cookie each time, do I need to delete the previous cookie? Or will the new cookie just overwrite the old cookie? I'm trying to avoid having multiple cookies on the user's machine -- just one. FYI, the cookie "name" will be the same every...
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 the following code, generating and reading the cookie seems to work fine. If I uncheck the box, the cookie should be removed or reset. For some reason, the cookie will not be changed and remains in the cookie folder (C:\Document and...
3
11111
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 behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
1
2009
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 Response.Cookies.Add(cookie) On the same page, user can click on a button to remove this cookie by
6
2595
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 ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name+"="+escape( value ) +
3
2074
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); document.cookie=c_name+ "=" +escape(value) +((expiredays==null) ? "" : ";expires=" +exdate.toGMTString());
0
8747
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
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 we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.