Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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")

Reply With Quote
  #2 (permalink)  
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
================================================== =========
Reply With Quote
  #3 (permalink)  
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?

Reply With Quote
  #4 (permalink)  
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?

Reply With Quote
  #5 (permalink)  
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
================================================== =========
Reply With Quote
  #6 (permalink)  
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?
Reply With Quote
  #7 (permalink)  
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
================================================== =========
Reply With Quote
  #8 (permalink)  
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

Reply With Quote
  #9 (permalink)  
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
================================================== =========
Reply With Quote
  #10 (permalink)  
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.