• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

End Session - Send to Page

Explorer ,
Nov 27, 2007 Nov 27, 2007

Copy link to clipboard

Copied

I'd like to send my user to the login page when their session expires and/or if they try to click on anything after the session has expired. Is this possible in the application.cfc using onSessionEnd? If so, how could I do it? If not, what's an alternative way to do this?
TOPICS
Advanced techniques

Views

573

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 27, 2007 Nov 27, 2007

Copy link to clipboard

Copied

I think you can put code for checking session at onRequestStart. If the login session is not exist, then redirect your user to login page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 29, 2007 Nov 29, 2007

Copy link to clipboard

Copied

Try the code below. Place it in your application.cfm
Since application.cfm is always called on every page, you users will be redirected to your login page once the session has ended. I user session.userID as an example. You can use any session variable that you have previously set up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2008 Sep 03, 2008

Copy link to clipboard

Copied

Mo Hadi

I tried the same code in my application.cfm file. But what it does is stopped the loading of the login page(index.cfm). I give you a brief overview of my code

Application.cfm File
<cfif #Session.Qlkid# EQ "">
<cflocation url="index.cfm">
</cfif>


Value of the session variable is set once the user logs into the site with a valid username and password

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 03, 2008 Sep 03, 2008

Copy link to clipboard

Copied

just add the check for the requested page into your cfif:

<cfif getfilefrompath(cgi.script_name) neq "your-login-page.cfm" AND
(NOT structkeyexists(session, "Qlkid"))>

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 18, 2008 Sep 18, 2008

Copy link to clipboard

Copied

LATEST
Hi azadi

this solution worked out fine.

Thanks a lot

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation