8

I tried to Kick a Sitecore user using the command below, but it seems it does not work

Sitecore.Web.Authentication.DomainAccessGuard.Kick(sessionID);

Even if I passed the current session ID, it does not kick the Sitecore User Out, Any ideias?

I got the Sessions with the following command

"DomainAccessGuard.Sessions"

Thank you

1
  • Have you checked that the DomainAccessGuard.Sessions count goes down after the kick?
    – Richard Seal
    Oct 9, 2017 at 20:37

2 Answers 2

3

After talking to the community and parsing the decompiled DLL I reached the conclusion that Sitecore Kick Method is only used to Free Sitecore License, not to Logout a Sitecore user from the session. In order to achieve that I would need to create some additional method to kill the IIS Session

Thanks all for the support on this ticket

0

The code to kick all users :

foreach(Session session in DomainAccessGuard.Sessions) 
{ 
    DomainAccessGuard.Kick(session.SessionID); 
} 

Update: Domain access guard manages license slots, not authentication. So after you kick a session auth cookies and sitecore user ticket remain valid and on the next request user get logged in automatically and occupies free license slot.

8
  • I don't think that wouldn't work - the Kick method is expecting a sessionID - not the user name.
    – Richard Seal
    Oct 9, 2017 at 20:33
  • Hi, the parameter is "sessionID", I tried with UserName, but it does not work. if I get the Sessions just after the Kick, that session will not be returned, so, it seems that worked, but the user can continue work on Sitecore, and the session will be live again. So, the Kick command does not kick the user with sessionId or Username Parameter
    – Jose Neto
    Oct 9, 2017 at 20:37
  • Based on that comment - it sounds like the user has the Remember Me box ticked and they are just creating a new session on the next request. The kick user doesn't do anything on the users browser to indicate to them that they have been kicked. It just removes their session.
    – Richard Seal
    Oct 9, 2017 at 20:38
  • Hi, the "remember me" check box is not marked as well
    – Jose Neto
    Oct 9, 2017 at 20:40
  • 1
    I think @MarkCassidy was referring to HttpContext.Session.Abandon();
    – Kevin
    Oct 10, 2017 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.