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

Killing all sessions when user goes to a public/unsecured page

Status
Not open for further replies.

lminmei

Programmer
Feb 1, 2000
111
US
when a user goes from a secured page to an unsecured page(public page)...i want coldfusion to kill all session variables and make the user login again. How do i do this?

my "LoginResults.cfm" code looks like this:

<cfquery datasource=&quot;Advice2000&quot; Name=&quot;ValidateLogin&quot;>
SELECT LoginID, Password
FROM Users
WHERE LoginID='#form.LoginID#' and
Password='#form.password#'
</cfquery>

<CFIF ValidateLogin.RecordCount IS 0>
<script language=&quot;javascript&quot;>
<!--
window.alert(&quot;Your Username and(or) Password is
incorrect, Try Again!&quot;);
self.location = 'advicelogin.cfm';
//-->
</script>
<cfelse>
<cfset Session.Validate = &quot;1&quot;>
<cfoutput>
<cflocation url=&quot;../secure/AdviceSiteMap.cfm?cfid=#cfid#&cftoken=#cftoken#&quot; addtoken=&quot;yes&quot;>
</cfoutput>
</cfif>

-------------
my &quot;application.cfm&quot; code looks like this:

<cfapplication name=&quot;AdviceLetter&quot;
sessionmanagement=&quot;Yes&quot;
setclientcookies=&quot;no&quot;
sessiontimeout=&quot;#CreateTimeSpan(0,0,30,0)#&quot;
applicationtimeout=&quot;#CreateTimeSpan(0,0,30,0)#&quot;>

<cfparam name=&quot;DSN&quot; default=&quot;Advice2000&quot;>

<CFIF NOT IsDefined(&quot;Session.Validate&quot;)>
<script language=&quot;javascript&quot;>
<!--
window.alert(&quot;You have not logged in! or Your session
has expired!&quot;);
self.location = '/test/advice/adviceletter/login/advicelogin.cfm';
//-->
</script>
</cfif>
[sig][/sig]
 
Hi, regarding yr question on killing all session.

The following is how i would do to destory all session.

<cfapplication name=&quot;admin&quot; sessionmanagement=&quot;Yes&quot; sessiontimeout=#createtimespan(0,0,0,0)# >

Hope it helps.

Jansen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top