473,698 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble removing cookies

I am having trouble removing cookies that I created with my site. Here is
the code I am using to try and remove them:
If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s.Remove("usern ame")
If Not Request.Cookies ("password") Is Nothing Then
Response.Cookie s.Remove("passw ord")
Is there something I am missing here? Even after I do a Session.Abandon ()
the cookies still seem to be there. Is there another step that is necessary?
Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Feb 24 '06 #1
3 1309
Nathan,

Instead of removing the cookies (I believe that just removes them from the
server memory and not the client) you should overwrite them on the client.

If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s("username") = ""
End If

Oh, and even an empty cookie may not be equal to "Nothing" because it is a
string you may need to test for "" instead.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I am having trouble removing cookies that I created with my site. Here is
the code I am using to try and remove them:
If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s.Remove("usern ame")
If Not Request.Cookies ("password") Is Nothing Then
Response.Cookie s.Remove("passw ord")
Is there something I am missing here? Even after I do a Session.Abandon ()
the cookies still seem to be there. Is there another step that is
necessary? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Feb 24 '06 #2
I figured out how to remove them, which is to set the Expires property to
somewhere in the past and the use the Response.Cookie s.Add() method.
However, what is the point in removing the cookies from the server memory if
they get resent with every Request anyway?
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in
message news:OI******** ******@tk2msftn gp13.phx.gbl...
Nathan,

Instead of removing the cookies (I believe that just removes them from the
server memory and not the client) you should overwrite them on the client.

If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s("username") = ""
End If

Oh, and even an empty cookie may not be equal to "Nothing" because it is a
string you may need to test for "" instead.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I am having trouble removing cookies that I created with my site. Here is
the code I am using to try and remove them:
If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s.Remove("usern ame")
If Not Request.Cookies ("password") Is Nothing Then
Response.Cookie s.Remove("passw ord")
Is there something I am missing here? Even after I do a Session.Abandon ()
the cookies still seem to be there. Is there another step that is
necessary? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


Feb 25 '06 #3
Nathan,

I'm not certain about that myself... It really may just be the object they
chose to hook up cookies with. It looks like the object is ultimately
inheriting from something similar to arraylist (if it isn't arraylist itself
I didn't bother to check). It may not be that they intended Remove to even
be used. It may just have come along for the ride via inheritance.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:O1******** ******@TK2MSFTN GP15.phx.gbl...
I figured out how to remove them, which is to set the Expires property to
somewhere in the past and the use the Response.Cookie s.Add() method.
However, what is the point in removing the cookies from the server memory
if they get resent with every Request anyway?
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote
in message news:OI******** ******@tk2msftn gp13.phx.gbl...
Nathan,

Instead of removing the cookies (I believe that just removes them from
the server memory and not the client) you should overwrite them on the
client.

If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s("username") = ""
End If

Oh, and even an empty cookie may not be equal to "Nothing" because it is
a string you may need to test for "" instead.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I am having trouble removing cookies that I created with my site. Here is
the code I am using to try and remove them:
If Not Request.Cookies ("username") Is Nothing Then
Response.Cookie s.Remove("usern ame")
If Not Request.Cookies ("password") Is Nothing Then
Response.Cookie s.Remove("passw ord")
Is there something I am missing here? Even after I do a
Session.Abandon () the cookies still seem to be there. Is there another
step that is necessary? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/



Feb 27 '06 #4

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

Similar topics

2
1603
by: Owen | last post by:
I have a web app that is a mixture of ASP and ASP.NET pages. Largely the only data passed between them is via the querystring, or by reading from a database. However there is a requirement for one part to communicate via a cookie. (Please dont ask me to go into why, I don't have time). In my ASP page, I created a cookie and put a value in it: Response.Cookies("MyCookieName") = "OriginalValue" Response.Cookies("MyCookieName").Expires...
3
1228
by: Nathan Sokalski | last post by:
I am having trouble removing cookies that I created with my site. Here is the code I am using to try and remove them: If Not Request.Cookies("username") Is Nothing Then Response.Cookies.Remove("username") If Not Request.Cookies("password") Is Nothing Then Response.Cookies.Remove("password")
3
1322
by: Kevin Blount | last post by:
I've created a quick set of test scripts, and I'm finding that cookies don't work as I would expect(i.e. the same as they do in original ASP. In original ASP I could set a cookie on one page, set another value to that cookie on a second page, then read them both back on a third page, but in .NET the second page overwrites the first. here are my three .NET test pages: setCookie1.aspx: Response.Cookies = "true";
3
1319
by: Groove | last post by:
Hey guys - hoping you can help me out here. I'm using asp.net 2 (VB) and trying to set and retrieve values from a cookie. I've done this a few times before w/o a problem but I seem to be overlooking something here. I'm even following my previous working examples and I can't see the different. I have a page that will remember the user's settings using a cookie. Ther Calendar Events, recent orders, etc will be displayed or hidden based...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8904
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,...
1
6531
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
5867
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
4372
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
3
2007
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.