Atozed Forums
How do I set different Timeout for different Users? - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: How do I set different Timeout for different Users? (/thread-3063.html)

Pages: 1 2


RE: How do I set different Timeout for different Users? - jeroen.rottink - 03-10-2023

Hmm. How do you deploy to the webserver? Indy windows service, http.sys or isapi.
I only have the posibility to test indy windows service at the moment.
Is the link to SessionTimeout.html in the generated document correct.
You are talking about a 500 error. Is it still the generated expection equal to post #7
Are you sure your new own exceptionhandler is registered? Is it called?


RE: How do I set different Timeout for different Users? - Mikael Nilsson - 03-12-2023

1. ISAPI dll
2. yes the link work in SA. But maybe there is another path needed in isapi.dll?
3. after the timeout time expires and I do a action in the web application I get 500 error 
4. yes it is called in SA. I have traced it.

Attaching my Server controller and project Source


RE: How do I set different Timeout for different Users? - Alexandre Machado - 03-21-2023

For reference,

the error 500 is a stupid thing that Microsoft decided to do regarding IIS. There is no way (that I'm aware of) to programmatically change this.

Please check section 8 of this document to learn how to setup IIS in a way that your error page will get to the end user:

https://docs.atozed.com/Docs.dll/deployment/isapi/Deploying%20ISAPI%20using%20IIS.html


RE: How do I set different Timeout for different Users? - ioan - 03-21-2023

(03-07-2023, 07:57 PM)Mikael Nilsson Wrote: Hi,

How do I set different Timeout for different Users?

Please see my answer here:
https://www.atozed.com/forums/archive/index.php?thread-931.html

Of course, in the StopHeartbeatTimer procedure you can have something like:


Code:
procedure StopHeartbeatTimer(AHeartbeatTimer: TIWTimer; ACount: integer);
var
  iHeartbeats: integer;
begin
  if ACount > 0 then
    iHeartbeats := ACount
  else
  begin
    // stop the timer after heartbeats and time out
    // a hearthbeat is every 20 seconds, so the timeout its (iHeartbeats * 20) seconds.
    if UserSession.LevelString = 'USER' then
      iHeartbeats := 30
    else if (UserSession.LevelString = 'AGENT') or (UserSession.LevelString = 'COMPANY') then
      iHeartbeats := 45
    else if (UserSession.LevelString = 'ROOT') or (UserSession.LevelString = 'OPERATOR') then
      Exit // do not timeout
    else
      iHeartbeats := 0;
  end;

  if AHeartbeatTimer.Tag > iHeartbeats then
  begin
    AHeartbeatTimer.Enabled := false;
    WebApplication.TerminateAndRedirect(...);
  end
  else
    AHeartbeatTimer.Tag := AHeartbeatTimer.Tag + 1;
end;

Probably not the best solution, but I've been using it for many years without any issues.