Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 26th, 2004, 08:09 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Deleting cookie in IE6

Hi.
I need some help here please.
I am building a site that needs authorization.
In order to do that , I am issuing a cookie in the login page,
and on every page, I'm checking if the cookie exists.
The problem begins when the user chooses " log out"
(which supposed to delete the cookie from the user's machine and redirect to the login page).
It works great in Mozilla and in Konqueror, but IE6 refuses to discard the cookie (and therefore allows access to pages (when the user clicks "Back" button or writing the url ) , eventhough the user is 'logged out')


the headers are the following:
# some defines
SESSION_COOKIE_NAME = "CookieName"
COOKIE_EXPIRE = 6000
companyID = 1

To issue the cookie:
print 'Content-Type: text/html'
print 'Set-Cookie:'+SESSION_COOKIE_NAME+'="'+(str)(companyID)+'";Version="1.0";Max-Age="'+(str)(COOKIE_EXPIRE)+'"'
print 'Cache-Control: no-cache=set-cookie'
print 'Cache-Control: max-age="0"'
print "\n\n"

To delete the cookie:
print 'Content-Type: text/html'
print 'Set-Cookie: '+SESSION_COOKIE_NAME+'="'+(str)(companyID)+'";Version="1.0";Max-Age="0"'
print 'Cache-Control: no-cache=set-cookie'
print 'Cache-Control: max-age="0"'
print "\n\n"


In all the pages (besides the login page). there is a check if the cookie exists.
After logout, the check in IE6 shows that the cookie still exists.
I'm assuming that it has to do with caching the cookie on IE6.
I tried using headers that suppose to surpress the caching of the pages as well as surpressing the Set-Cookie header caching.
I used the recommendations written in the RFC2109 but it still doesn't work.
( I can't verify that the cookie exists / not exists in IE6 because I can't find it in the Hard drive)

Thanks for your help
Roy

Last edited by roypython : April 27th, 2004 at 06:41 PM.

Reply With Quote
  #2  
Old April 29th, 2004, 08:50 PM
TheBlackMamba TheBlackMamba is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 25 TheBlackMamba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to TheBlackMamba Send a message via Yahoo to TheBlackMamba
Lightbulb

I would recommend setting another cookie indicating that the user had logged out.
You could also put a date in the original cookie and have your code not allow the user back until a certain time after that date. good luck

Reply With Quote
  #3  
Old April 30th, 2004, 03:23 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 3 m 4 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
In theory (and i've had no problems with this) reseting the cookie with an expired timestamp should remove it. This could have something to do with the way you are type-casting as i've never seen the:

(str)(companyID)

in Python before. In which case you should check this form in IDLE but i dont believe this is what you want... try

str(companyID)

instead. You might also want to look and the Cookies module

Hope this helps,

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Deleting cookie in IE6


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT