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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Cookie Logout

Status
Not open for further replies.

DonP

IS-IT--Management
Jul 20, 2000
684
US
I'm using an Access database with username and password, but have it set up to store a cookie on the client. I didn't write the code myself but found it somewhere and modified it to suit. It seems to work just fine and as long as the username matches the Access username via a required file in each of the scripts being used with it. There's no problem there at all. When the browser is closed, it seems to remove the cookie, but how can I add a simple "Logout" button (or hyperlink) that will delete the cookie directly? The cookie itself seems to be created by a JavaScript, but everything else is VBscript, and that's where I want to use the "Logout". I'm not sure what, if any, code I can post here than might help answer the question.

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Thanks! I read through it (I saw it before I posted) but since I'm not a programmer, I wasn't sure what to do with the information. Does it mean that I need to create another script to delete the Cookie? If so, how can I do it from a simple hyperlink on my site? The Cookie has only one value so it pretty straight-forward.

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Hi,

You are using ASPs, right? You must creat a Logout.asp with a nice message to the client. There you must include runat server ASP code saying that the cookie will expire when the session ends or when the client close its browser. To do that you must use

Response.Cookies("myCookie").ExpiresAbsolute = "July 31, 2000"

If database access is made based on cookie information you simply change the information

Response.Cookies("myCookie") = ""

Check your cookie JavaScript code and take date expires information off.

Regards,
Luís Silva
 
Hello, Yes, thank you! I figured it out, though I decided to create a separate script with a form for the logout confirmation, another to do the actually deleting of the cookie and yet another as a "thank you" type of page. For me, it was easier than doing it as one script and it seems to work like a charm.

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top