Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Trouble removing cookies

Reply
Thread Tools

Trouble removing cookies

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      02-24-2006
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")


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
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      02-24-2006
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.Cookies("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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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")
>
>
> 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
> (E-Mail Removed)
> http://www.nathansokalski.com/
>



 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      02-25-2006
I figured out how to remove them, which is to set the Expires property to
somewhere in the past and the use the Response.Cookies.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
(E-Mail Removed)
http://www.nathansokalski.com/

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:(E-Mail Removed)...
> 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.Cookies("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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>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")
>>
>>
>> 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
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>

>
>



 
Reply With Quote
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      02-27-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I figured out how to remove them, which is to set the Expires property to
>somewhere in the past and the use the Response.Cookies.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
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote
> in message news:(E-Mail Removed)...
>> 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.Cookies("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" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>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")
>>>
>>>
>>> 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
>>> (E-Mail Removed)
>>> http://www.nathansokalski.com/
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
Removing GPO setting from XP machine after removing from Domain Piet Slaghekke Computer Support 4 01-02-2007 08:58 PM
removing a namespace prefix and removing all attributes not in that same prefix Chris Chiasson XML 6 11-14-2006 05:08 PM
Trouble removing cookies Nathan Sokalski ASP .Net 3 02-27-2006 11:12 AM
removing cookies / cleaning history Iain Computer Security 1 02-06-2005 03:47 AM



Advertisments