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

Session not timing out...

New Here ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

Hi all, for some reason, my session is not timing out. If I leave my browser and come back the next day, I can still continue working. Can someone tell me why?
My code
<cfapplication name="myApp" sessionmanagement="yes" sessiontimeout="#CreateTimeSpan(0,0,30,0)#">

Thank you so much,
C
TOPICS
Advanced techniques

Views

394

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

<cfapplication name="myApp" sessionmanagement="yes"
sessiontimeout="#CreateTimeSpan(0,0,30,0)#">

What are you doing when a session times out? The above code will always
create a new session whenever it is run and a browser will continue to
work just fine. What will be gone is any session data previously
generated before the time out. But if you are automatically
regenerating this data or somehow handling when it is missing, nothing
obvious would necessary happen.

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

Hi Ian, how can I make it so that after 30 minutes if a user tries to hit any page in my site, they would go back to login page to relogin?

Thanks so much,
C

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

Hi Ian, how can I make it so that after 30 minutes if a user tries to
hit any page in my site, they would go back to login page to relogin?

Thanks so much,
C

Check that the session data still exists. This will very depending on
how exactly you are handling your login state. But since you mention
session, I will presume you are rolling your own rather then using the
<cflogin...> some other functionality.

I would do something like this in my code.

<cfif NOT StructKeyExists(session, "LoginName")>
<cflocation url="LoginForm.cfm">
</cfif>

Obviously you would set session.LoginName to some value on a successful
login. Also note that if this check occurs before the LoginForm.cfm
page you will create an endless loop. There are much more sophisticated
solutions, but this gives you a bare bones option.

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

Hi Ian, thanks for your response. I am actually using <cflogin> in my code, but for some reason i could not set session variables inside <cflogin>...</cflogin>

I will work on your suggestions above,

Thanks again,
C

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

If you are using the <cflogin> framework, this check is built into that.
What ever is between <cflogin> tags will run if the user is not
logged onto the system, including after a timeout. Just place the
appropriate logic between the tags.

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 ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

LATEST
Hi Ian, thank you for your response, I'm a little confused: I have this in application.cfm
<cfapplication name="myApp" sessionmanagement="yes"
sessiontimeout="#CreateTimeSpan(0,0,30,0)#">
...
<cflogin>....code for validation ...</cflogin>

With this, my session never seems to expire (seems like user is always logged in). Only after I click logoff (<cflogout>), user will need to relogin. What kind of logic should I put in between the cflogin tags?

Thanks so much,
C

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