Alpha DevCon 2018
Results 1 to 9 of 9

Thread: Session Expiration

  1. #1
    "Certified" Alphaholic Phil Rolf's Avatar
    Real Name
    Philip Rolf
    Join Date
    Apr 2000
    Location
    Kentucky
    Posts
    1,539

    Default Session Expiration

    How can you detect when a session has expired so when the user clicks on submit I can take them to a page informing them that the session has expired and then they would have to go back to the dialog.

  2. #2
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,775

    Default Re: Session Expiration

    I don't know how to detect when Alpha's session expires, but you can find javascript that counts the seconds of inactivity, and then pops an alert dialog box when a time threashold was met. So, if your WAS is set to one hour, you set the javascript to 55 minutes to pop an Alert saying the session is about to expire unless you refresh the page. Or the timer could be set equal to the WAS and say "You've timed out" and then on OK, redirect to a new page. I have some of this somewhere if you can't find it.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    "Certified" Alphaholic Phil Rolf's Avatar
    Real Name
    Philip Rolf
    Join Date
    Apr 2000
    Location
    Kentucky
    Posts
    1,539

    Default Re: Session Expiration

    Steve, I found a temporary solution without using a javascript within the dialog

    Code:
    Component Initialize
    session.FlagIsLoggedIn = .t.
    
    Component Validate
    
    if eval_valid("session.FlagIsLoggedIn") = .f. then
        response.redirect("timeoutwarning.a5w")
        end
    end if
    The downside is that they will not know that the session has expired until they hit submit....I will try to refine but this will work for now. The timeoutwarning page is simply a message about the session expiring and a button to click to return to the dialog.

    Thanks

  4. #4
    Member
    Real Name
    Michael Scholin
    Join Date
    May 2007
    Location
    Madison, WI
    Posts
    321

    Default Re: Session Expiration

    Phil,

    Has this work well for you and/or have you improved it any?

    I am having some problems with people being logged in for too long at a time, losing their session variables and then complaining that something is wrong with the database. I tell them to log out and then log back in - in most cases that is the only problem.

    This looks like a decent solution so I wanted to check with you before I implement it to see if you have made any improvements. Thanks!

    Mike

  5. #5
    Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,698

    Default Re: Session Expiration

    I thought that this was one of the uses of eval_valid, i.e., if you always use eval_valid wheneber you use a session variable than you can redirect the user to any page you want when that session variable no longer is "valid", i.e, the session has expired.

    So

    if eval_valid("session.anything")
    .
    .
    .
    else
    response.redirect("go to apge that says "Your session has expired, and offeres the login compoent

    end if


    Gary

  6. #6
    "Certified" Alphaholic Phil Rolf's Avatar
    Real Name
    Philip Rolf
    Join Date
    Apr 2000
    Location
    Kentucky
    Posts
    1,539

    Default Re: Session Expiration

    I am sorry but I thought I had answered this thread on what I had found. The problem actually turned out to be a path problem. Thru out my pages I was using the following format https://www.domain.com In ONE location I had https://domain.com When the user tried to go to the domain.com then the session was terminated. Inserting the www to the path corrected my problem.

  7. #7
    Member
    Real Name
    Michael Scholin
    Join Date
    May 2007
    Location
    Madison, WI
    Posts
    321

    Default Re: Session Expiration

    Great point Gary, I can see where that would work. I guess I can actually place that on any page that is entered into as well as in the event CanUpdateRecord. I will give that try. Thanks!

  8. #8
    Member
    Real Name
    Michael Scholin
    Join Date
    May 2007
    Location
    Madison, WI
    Posts
    321

    Default Re: Session Expiration

    Phil - I looked and sure enough, I too have a couple of site references without the www!

    I am going to search the rest of my database for similar problems and I am going to use the "eval_valid("session.variable") to make it even a bit more bullet proof.

    Thank you for your help Phil and Gary!

  9. #9
    Member Purvi's Avatar
    Real Name
    Purvi Patel
    Join Date
    May 2011
    Location
    Houston
    Posts
    73

    Default Re: Session Expiration

    Quote Originally Posted by Steve Wood View Post
    I don't know how to detect when Alpha's session expires, but you can find javascript that counts the seconds of inactivity, and then pops an alert dialog box when a time threashold was met. So, if your WAS is set to one hour, you set the javascript to 55 minutes to pop an Alert saying the session is about to expire unless you refresh the page. Or the timer could be set equal to the WAS and say "You've timed out" and then on OK, redirect to a new page. I have some of this somewhere if you can't find it.
    I was looking for something similar to use in my Home Page containing Tabbed UI, if you can please share it here Steve!

    Thanks in Advance!

Similar Threads

  1. Session ID
    By gregz in forum Application Server Version 8
    Replies: 6
    Last Post: 12-05-2007, 02:50 PM
  2. Table used in another session
    By John Fringer in forum Alpha Five Version 6
    Replies: 2
    Last Post: 01-12-2005, 10:14 AM
  3. Force password expiration
    By David Farr in forum Alpha Five Version 5
    Replies: 0
    Last Post: 08-04-2003, 12:58 PM
  4. A5V5 BETA EXPIRATION
    By nehru albania in forum Alpha Five Version 4
    Replies: 7
    Last Post: 05-20-2002, 08:31 PM
  5. A5V5 BETA EXPIRATION
    By nehru albania in forum Alpha Five Version 4
    Replies: 2
    Last Post: 05-20-2002, 09:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •