You are here: Web Apps with Visual LANSA > 21. Troubleshooting > 21.5 Web Application Session has expired

21.5 Web Application Session has expired

If you get this message, the Server Module session has expired but the failure has not been captured on the client.

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