user1611655
user1611655

Reputation: 41

Only one session of same application, per user, at a time, in Intraweb

I try to investigate around the Intraweb for Delphi 2010. I have a web page inside a CRM application, and every time the user flips customer, the web page is refreshed. However the sessions of "old" pages remain active, and I get a "the edition is limited to 5 active sessions". How do I remove the old sessions, when a new session is created, it must of cause be the same application id, and only for the current user.

Upvotes: 0

Views: 1381

Answers (1)

user1611655
user1611655

Reputation: 41

I ended up with this. https://forums.embarcadero.com/thread.jspa?messageID=525644

procedure TIWServerController.IWServerControllerBaseNewSession
    (ASession: TIWApplication; var VMainForm: TIWBaseForm);
var
    i:      integer;
    List:   TList;
    App:    TIWApplication;
begin
    List:=GSessions.LockList;
    try
        for i:=0 to List.Count - 1 do begin
            App:=TIWApplication(List[i]);
            if App <> ASession then begin
                GSessions.Remove(App);
                App.Free;
            end;
        end;
    finally
        GSessions.UnLockList;
    end;
    ASession.Data:=TIWUserSession.Create(nil);
end;

Upvotes: 1

Related Questions