delphisessionintraweb

Login page session timeout for kiosk


We have a web-based product written in Delphi and Intraweb, that can be run on a public kiosk (full-screen).

Is there any way using Intraweb to display a login page that isn't part of any session (just a standard Intraweb page), so the session only gets created when the user successfully logs in?


Solution

  • The best way we've found of doing this is to use Javascript to make an AJAX request every 30 seconds or so to Intraweb to make Intraweb think the page is still in use and thus won't time out the session.

    Javascript (call the Intraweb AJAX method every 30 seconds):

    <script type="text/javascript">
      document.addEventListener("DOMContentLoaded", function(event) {
          window.setInterval(function() {
              executeAjaxEvent("", null, "ResetSessionTimer", false, null, true);
          }, 30000);
      });
    

    Delphi (private method and registering the callback):

    procedure TfrmLogin.ResetSessionTimer(EventParams: TStringList);
    begin
     //Intraweb does everything for us, we just need this method to exist
    end;
    
    WebApplication.RegisterCallBack('ResetSessionTimer', ResetSessionTimer);