Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I set different Timeout for different Users?
#11
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?
Reply
#12
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


Attached Files
.txt   isapiXIBwwd.txt (Size: 4.39 KB / Downloads: 6)
.txt   ServerController.pas.txt (Size: 2.91 KB / Downloads: 6)
Reply
#13
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/deploym...20IIS.html
Reply
#14
(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/in...d-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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)