OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Simple Session Log Out Button

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Simple Session Log Out Button
Page: [1]
 
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
Simple Session Log Out Button - 10/4/2009 16:23:28   
I am looking to add a simple session log out button to my page. I have been trying different code but not able to get one to work. I propably have a quote sign out of place:)

Something Like

<form>
<input type="button" value="Log Out" onclick="Session.Clear();Session.Abandon();FormsAuthentication.SignOut();Response.Redirect("login.asp")"></form>
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
RE: Simple Session Log Out Button - 10/4/2009 19:52:01   
There I go mixing my languages, what a rookie move.:)

I probably mean something more like:

<input name="<% Session.Clear() Session.Abandon() Response.Redirect("login.asp") %>" type="submit" value="Log Out">


or like


<FORM>
<INPUT TYPE="button" VALUE="Log Out"
onClick="<%session.Abandon()%>;return false;" />
</FORM>

< Message edited by Mav44 -- 10/4/2009 23:13:48 >

(in reply to Mav44)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Simple Session Log Out Button - 10/5/2009 2:15:16   
You are trying to run a server side call on the client - better off passing it to a logout page that then redirects somewhere.

logout.asp:
<%
Response.Buffer=True
session.abandon
response.cookies("your_cookie") = ""
response.Cookies("your_cookie").path="/"
response.cookies("your_cookie").Expires = date - 30
response.clear
response.redirect "default.asp"
%>


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Mav44)
Mav44

 

Posts: 197
Joined: 6/25/2006
Status: offline

 
RE: Simple Session Log Out Button - 10/5/2009 9:00:14   
Thanks Spooky, I did some reading and that is the way to go. I also found the following script on this site from Rdouglass that does a good job of not caching the page so the user cannot use the back button after logout. I added this to the top of my main pages.

<%'@ Language="VBSCRIPT"%>
<%'Option Explicit

'-------------------

Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Cache-Control", "must-revalidate"
Response.AddHeader "Cache-Control", "no-cache"
%>


Thanks Guys, I love this site.

(in reply to Mav44)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Simple Session Log Out Button
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts