Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This example is based on XDemoWebSessions. If you use the following code, the Fatal session error will not occur because the #TestSession.Failed event is captured and processed.

    Evtroutine Handling(#Test.Click)

#Com_owner.TestSession
 
Endroutine
 
Mthroutine Name(TestSession)
 
Define_Com Class(#xDemoSessionServices.TestSessionState) Name(#TestSession)
 
#io$sts := ""
#Test.Caption := "Testing Session"
 
#TestSession.ExecuteAsync( #Io$sts )
 
Evtroutine Handling(#TestSession.Completed)
 
#Com_owner.UpdateSession( True )
 
#Test.Caption := "Test (Success)"
 
Endroutine
 
Evtroutine Handling(#TestSession.Failed) Reason(#Reason) Handled(#Handled)
 
#Handled := True
 
Case (#Reason)
 
  When (= Unknown)
 
  #Test.Caption := "Test (Failed)"
 
  When (= SessionInvalid)
 
  #Test.Caption := "Test (Session Invalid)"
 
Endcase
 
#Com_owner.UpdateSession( False )
 
Endroutine

 
If you modify the code to remove the handling of the #TestSession.Failed the above message will be produced when the session expires.

 
Evtroutine Handling(#Test.Click)
 
#Com_owner.TestSession
 
Endroutine
 
Mthroutine Name(TestSession)
 
Define_Com Class(#xDemoSessionServices.TestSessionState) Name(#TestSession)
 
#io$sts := ""
#Test.Caption := "Testing Session"
 
#TestSession.ExecuteAsync( #Io$sts )
 
Evtroutine Handling(#TestSession.Completed)
 
#Com_owner.UpdateSession( True )
 
#Test.Caption := "Test (Success)"
 
Endroutine
 
Evtroutine Handling(#TestSession.Failed) Reason(#Reason) Handled(#Handled)
 
* nothing processed here
 
Endroutine