Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a cookie? Help!!!!!!!!

Status
Not open for further replies.

Ladyborg

Programmer
Joined
May 11, 2002
Messages
208
Location
US
Surely there MUST be a way to delete an existing cookie from a site I've built with UD. I've created a login and logout pages, but when I login again in a different name, it still shows me logged in in the first username.

I need to be able to delete any existing cookie on "logout". Ladyborg
"Don't be afraid to try new things,
Remember: professionals built the Titanic, amateurs built the Ark"
 
I have already tried that. I created the logout.asp page with the code as per that link you gave. BUT once I log in again, it goes throught the whole logging in process ok, but when I go to a page that shows which name I am logged in as, I still see the original name.

I need to be able to delete the cookie off the user's machine upon logout. Ladyborg
"Don't be afraid to try new things,
Remember: professionals built the Titanic, amateurs built the Ark"
 
Without seeing any code, I'd bet that your login page has different code than the logout page. Like maybe you are logging in with one cookie name and trying to destroy a cookie with a different name. "Insert witty remark here"

Stuart
 
Thanks for your help. Here is the code for both pages.

Login.asp:
<%
Dim rsOrrLogin__MMColParam
rsOrrLogin__MMColParam = &quot;1&quot;
if (Request.Cookies(&quot;Username&quot;) <> &quot;&quot;) then rsOrrLogin__MMColParam = Request.Cookies(&quot;Username&quot;)
%>


Logout.asp:
<% Response.Cookies (&quot;Username&quot;) = &quot;&quot; %>
<% Response.Redirect &quot;logoutsuccess.asp&quot; %> Ladyborg
&quot;Don't be afraid to try new things,
Remember: professionals built the Titanic, amateurs built the Ark&quot;
 
Try

Logout.asp:
<% Response.Cookies (&quot;Username&quot;).Expires = Date - 1 %>
<% Response.Redirect &quot;logoutsuccess.asp&quot; %>

This should delete the cookie from the users system The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Didn't work! :-( I don't understand it. Ladyborg
&quot;Don't be afraid to try new things,
Remember: professionals built the Titanic, amateurs built the Ark&quot;
 
OK, I think I did it. Instead of having dynamic text come from the db itself (i.e.: you are logged is as ladyborg, click here to log out), I am taking the info from the MM_Username session variable which is created on successful logon.

Now I have one more little problem. My shopping cart (UD4) still contains items put into the cart on a previous session, when I logged in in another name. How do I clear shopping cart on logout?

Thanks again for your invaluable help! ::-) Ladyborg
&quot;Don't be afraid to try new things,
Remember: professionals built the Titanic, amateurs built the Ark&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top