Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook



The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic

Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.

If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.

Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.

Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

How can I redirect user to login page when session times out?

  • Filter
  • Time
  • Show
Clear All
new posts

    How can I redirect user to login page when session times out?

    I did some searches on this, but cannot seem to find an answer.

    If I set a session lifetime for 8 hours (or 2 hours, or 36 hours), and the session times out, the user often sees a red error message if they go to a component which uses a session variable for a filter.
    I would like to automatically send the user to the login page when the session times out.
    Is that possible?
    Jay Talbott
    Lexington, KY

    Re: How can I redirect user to login page when session times out?

    that is a standard option under web security configuration, look for login timeout.
    Steve Wood
    See my profile on IADN


      Re: How can I redirect user to login page when session times out?

      Thanks, Steve, and maybe I am being too picky, but if the user tries to run a query and the session variables are gone, the error is encountered. If the user tries to reload the page, it does return to the login screen, but unless the page is reloaded, the error is encountered.
      Last edited by Jay Talbott; 12-31-2013, 03:59 PM.
      Jay Talbott
      Lexington, KY


        Re: How can I redirect user to login page when session times out?

        Hello Jay,

        This is definitely possible as I have been using this method for a couple of years now.
        I set a session timeout of 120 minutes using a countdown counter. When the session times out, the user is automatically logged out and redirected to the login page.
        I set the session timeout on the server slightly longer (130 minutes I think) so that the server doesn't timeout before my counter.
        Some code is required to stop the browser caching the page and prevent the user from simply clicking the back button to log back in.
        I'm using a tabbedui and display the session time remaining in the header. If the user doesn't want the session to timeout they can simply F5 to refresh the page.

        Here's what it looks like, look in the top left corner:

        Session Timer.jpg

        The timer code goes in the head section of my home page (credit to Carole King)

        <table><tr><td>Logged In: <%a5 ?session.current_user_fname %>&nbsp;<%a5 ?session.current_user_lname %>&nbsp;<a href="logout.a5w"><font color=#0000ff>(Logout)</font>
        <font color=#ffffff></td></tr></table>
        <script language="javascript">
        <!-- Begin
        // Take user here after session timed out
        timedouturl = "Login.a5w";
        function Minutes(data) {
        for (var i = 0; i < data.length; i++)
        if (data.substring(i, i + 1) == ":")
        return (data.substring(0, i));
        function Seconds(data) {
        for (var i = 0; i < data.length; i++)
        if (data.substring(i, i + 1) == ":")
        return (data.substring(i + 1, data.length));
        function Display(min, sec) {
        var disp;
        if (min <= 9) disp = " 0";
        else disp = " ";
        disp += min + ":";
        if (sec <= 9) disp += "0" + sec;
        else disp += sec; 
        return (disp);
        function Down() { 
        if (sec == -1) { sec = 59; min--; }
        document.getElementById("clock1").value = Display(min, sec);
        //window.status = "Session will time out in: " + Display(min, sec);
        if (min == 10 && sec == 00) {
        //alert("Your session will time out soon.  Make sure work is saved.  You can extend your session time by refreshing your browser.");
        down = setTimeout("Down()", 1000);
        else if (min == 0 && sec == 0) {
        alert("Your session has timed out.  You will be redirected and can Log In again, if needed.  Thank You.");
        window.location.href = timedouturl;
        else down = setTimeout("Down()", 1000);
        function timeIt() {
        min = 1 * Minutes(document.getElementById("clock1").value);
        sec = 0 + Seconds(document.getElementById("clock1").value);
        //  End -->
        &nbsp;Session Time Remaining: <input id="clock1" style="font-size: 8pt; color: #008000; text-align: center; border-width: 0px;" name="clock" size="5" value="120:00" readonly >min. Refresh page to extend time.
        <script language="javascript">
        And to prevent the browser back button, I also add this to the header section.

        <script type="text/javascript">
        function noBack(){window.history.forward();}
        I hope this is useful for you.

        Last edited by iRadiate; 05-24-2013, 08:22 PM. Reason: Added an additional pointer
        Alpha Anywhere v12. Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V


          Re: How can I redirect user to login page when session times out?

          This looks tremendously helpful.
          Thanks, and I will report back when I have had a chance to test it.
          Jay Talbott
          Lexington, KY


            Re: How can I redirect user to login page when session times out?


            Here is a quick video showing the timer in action.
            In the top left corner, you will see the timer count down to zero.
            A alert window pops up explaining to the user that their session has timed-out.
            The page is then redirected to the login page. I click the browser back button to show that you can't simply click back to log back in.
            After logging back in, the session counter starts over at 120 minutes again.


            Alpha Anywhere v12. Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V


              Re: How can I redirect user to login page when session times out?

              Just Wow! Thanks Stephen (and Carol King) for providing that code. I was searching through the forum for something else and stumbled upon this post. I've been wanting to explore if something like this was possible, but with so much other stuff that had priority over it, it got bumped to the bottom of my list. This took me all of about 10 minutes to tweak and get working!! I think my client will be impressed - I know I am!

              Thank you, thank you, thank you!
              Last edited by Melissa Smith; 05-31-2013, 01:39 PM. Reason: Oops, wrong name!
              Melissa Smith
              Triskelion Consulting, LLC


                I had reason to use this code today, and it works great.
                Is there a way to reset the timer programatically when someone clicks on a Tabbed_UI button, for example? I can reset the minute variable using the Chrome debugger by submitting this in the Console:
                min = 30

                However, I am not sure of the scope when working with the tabbed UI. Perhaps I have to put the time in a span and then update it.
                Thanks again.
                Jay Talbott
                Lexington, KY


                  Hi Jay, well to be honest I moved away from the TabbedUI many years ago now and replaced it with a more versatile expanding menu inside a panel card.
                  When I did that I also stopped using the session timeout method above.

                  Alpha Anywhere v12. Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V


                    Thanks. I am working on an old app with the Tabbed_UI, and would like to get away from that also.
                    Jay Talbott
                    Lexington, KY