'1. use try and catch
Dim IsSessionInvalid As Boolean=False
Try
ws.Session.GetAttribute2("userid",-1)
Catch
IsSessionInvalid=True
End Try
Log("Is Session Invalid "&IsSessionInvalid)
'2 use a timer to check
Dim wsexpiretime As Long =ws.Session.LastAccessedTime+ws.Session.MaxInactiveInterval*1000
Dim wst2expire As Long =(wsexpiretime-DateTime.Now)/1000
Log("wst2expire " &wst2expire)