B4J Question ABMaterial 5.0 - ABMPageId

prajinpraveen

Active Member
Licensed User
Longtime User
Good day,

Upgraded the ABM 5.0. Every time the page websocket_connected is called, it generates a new ABMPageId as opposed to the same pageid


ABMPageId = ABM.GetPageID(page, Name,ws)

LOG
pagemap (MyMap) {one=, frmHome=frmHomeeb55e2b8-d63d-4553-bf9e-5336d098e466}
ABMPageid frmHome02fdb7bd-66b8-4036-87f6-406be3212ac2
recordedpageid frmHomeeb55e2b8-d63d-4553-bf9e-5336d098e466
 

prajinpraveen

Active Member
Licensed User
Longtime User
code1:
'----------------------MODIFICATION-------------------------------
    Log("Connected")
        
    ws = WebSocket1
    ABMPageId = ABM.GetPageID(page, Name,ws)
    
    Dim session As HttpSession = ABM.GetSession(ws, ABMShared.SessionMaxInactiveIntervalSeconds)
    If session.IsNew Then
        session.Invalidate
        ABMShared.NavigateToPage(ws, "", "./")
        Return
    End If
    
    
    ABMShared.ValidateDuplicateSession(page,ABMPageId,Name)
    
    
    If ABMShared.NeedsAuthorization Then
        If session.GetAttribute2("IsAuthorized", "") = "" Then
            ABMShared.NavigateToPage(ws, ABMPageId, "../")
            Return
        End If
    End If

code2:
Sub ValidateDuplicateSession(page As ABMPage,ABMPageid As String ,PageName As String)

Dim pagemap As Map = page.ws.Session.GetAttribute2("pages",CreateMap("one":""))   
    Log("pagemap " & pagemap)
 If pagemap.ContainsKey(PageName) = False Then       
     ' add this page to the list
    pagemap.Put(PageName,ABMPageid)       
    page.ws.Session.SetAttribute("pages",pagemap)
Else
        Dim recordedpageid As String = pagemap.Get(PageName)
        Log("ABMPageid " & ABMPageid)
        Log("recordedpageid " & recordedpageid)
        If recordedpageid <> ABMPageid Then
            ' Duplicate tab or new broweser opened       
            page.ShowToast("toast" & 10021, "toastred", "Your Session is Invalid. Cannot use multiple browser sessions", 5000,False)
            LogOff(page)
        End If
    End If

End Sub
 
Upvote 0
Top