Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2007, 11:01 AM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default Log out

i am trying to create a logout button, DreamWeaver created alot of messy code so i thought i would give it a bash.
i couldnt find much help through google so i came here. When people login, a session is started in a global.asa file i created and i have working authentication but i want to create a logout button that ends the session and redirects.
any ideas?
i know some of the code i want to end the session ie:

session("authenticate") = 0
response.redirect("page.html")

 
Old February 28th, 2007, 11:18 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Use Session.Abandon()

WARNING - this will drop ALL session variables for the current session.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old February 28th, 2007, 11:22 AM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

right, so if i create a button and use that with a redirect that would be ok?

 
Old February 28th, 2007, 11:23 AM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

ps - what does dropping all session variables mean? what would be affected by this?

 
Old February 28th, 2007, 11:29 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes, if you call Session.Abandon() and redirect the user, the will be logged out. This ONLY applies if you are using session variables to determine if a user is logged in if, however, you are using cookies you will need to write code that will terminate the cookie as Session.Abandon() has no effect on them.

What I mean by dropping all session variables is that once you call Session.Abandon() and session variable that you may have created for the current user will be gone.

Think of an entire session as an array and everytime you create a Session Variable, you add a dimension to that array that holds some information. When you call Session.Abandon() our hypothectical array will have all of its dimensions removed thus any session data associated with the current session is deleted.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old February 28th, 2007, 11:36 AM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

thanks

as it stands i have a global.asa file with a session.timeout, session("authenticated") and session ("Start") = now

when the user logs in, session authenticated = 1 and all the protected pages checks this and should it = 0 then the user is redirected to the login page again.

i havent used cookies (knowingly) as i am still learning about what they do and i felt it was something i shouldnt mess with until i have grasped all the basics.

im guessing with what i told you about the global.asa file that i am using session variables only and so therefore session.abandon should work. is there no other code i require for a button then? the session and the redirect will suffice? will response.redirect work or do i want to look at java redirects?
 
Old February 28th, 2007, 11:40 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Session.Abandon() will work in this instance and yes, a regular response.redirect will work.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old February 28th, 2007, 11:46 AM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

thanks for that

 
Old February 28th, 2007, 11:48 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Sure, no problem. ^^

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old February 28th, 2007, 12:08 PM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

to add to this, i made a flash button which dreamweaver hashes up and creates a shed load of code for!! is there a simpler way to create a button as i am realising more and more the amount of code DW creates!

i searched google but most of it seemed junk, doesnt physically describe the code, what code would i look to write it in and i will research myself.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot log in brianrodda ASP.NET 2.0 Basics 1 July 15th, 2008 09:02 AM
How to log to server's event log LenexaKS Access VBA 4 March 11th, 2008 12:49 PM
Can't get Log to write the Log.txt file jnbutler BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 July 31st, 2007 04:04 AM
need log on help mohiddin52 Oracle 4 February 14th, 2005 02:20 PM
AppException Class -Log Error to Event Log bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 7 December 7th, 2004 01:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.