473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Delete Cookies

snowwwolf
How Can I delete the cookies.

I wrote like that

Response.Cookies.Remove("password");

but, it did not work.

I use ASP.NET 1.1 with C#
<X>
Jan 21 '07 #1
2 1561
kenobewan
4,871 Expert 4TB
If you want to delete the cookie on the client machine, do not use the obvious Response.Cookies.Remove("MyCookie") which simply tells the cookie not to overwrite the client's cookie (see below for a more detailed explanation), set the cookie's Expires property to any time prior to the current time. This will tell the client to overwrite the current cookie with an expired cookie and the client will never send it back to the server.

The safest (and most symmetric) way to delete the cookie by using an Expiry date of DateTime.Now.AddYears(-30)...

Hope that this helps.
Jan 21 '07 #2
If you want to delete the cookie on the client machine, do not use the obvious Response.Cookies.Remove("MyCookie") which simply tells the cookie not to overwrite the client's cookie (see below for a more detailed explanation), set the cookie's Expires property to any time prior to the current time. This will tell the client to overwrite the current cookie with an expired cookie and the client will never send it back to the server.

The safest (and most symmetric) way to delete the cookie by using an Expiry date of DateTime.Now.AddYears(-30)...

Hope that this helps.

yes, i got it, thanks for your replay!
Jan 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
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...
2
by: Dan | last post by:
I persist the login info using cookies so that a user doesn't have to login every time they come to our website, unless they previously logged out. Everything works OK on W98 SE, and Windows XP Pro...
3
by: Warp | last post by:
If I have a cookie with 'key/value' pairs, how would I delete a specific 'key/value' pair while preserving the remaining pairs? I tried to do something like: cookie(key)="" but it didn't seem to...
2
by: phoenix | last post by:
Hello, I tried the following to delete the cookies Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Cookies ), true); but always get the message that "index.dat" is...
3
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...
0
by: Bill Borg | last post by:
Hello all, Not sure I can describe this adequately, but I am creating an endless loop when an authenticated user signs out. When the user signs out, I want to remove authentication, abandon...
5
by: ad | last post by:
Hi, How can I delete the cookie in client?
3
by: kendera | last post by:
Is it possible to programmatically delete cookies? Can anyone help me with this...
4
by: itrahulsoni | last post by:
hi all, I want to delete the cookies that are set by the google personalize home page or when once i view the you tube video cookie is set I want it to delete programmatically so I am able to see...
2
Inbaraj
by: Inbaraj | last post by:
Hi I have create a cookie as document.cookie=text1.value+" "+text2.value; I am able to retrive the cookies... But i am not able to delete the cookies... Plz help me in deleting the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
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...

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.