Logout a User from Site (Concurrent User Login)

rajiv kumar asked on April 11, 2016 09:29

How do i logout a user from the first machine , when the user login for the second time using the same User credentials from another machine..?

Correct Answer

Jan Hermann answered on April 11, 2016 13:38

Hello,

not a scheduled task. This should be handled per request or per page load.

If you want to do this per request, you can take advantage of global events -> in your case RequestEvents.Begin.Execute:

https://docs.kentico.com/display/K9/Reference+-+Global+system+events

If you want to do it per page load, then you can customize/clone the PortalTemplate and do the check there or you can create a new web part and place it on your master page.

And the the IP address for checking in scenarios above would be stored directly to the user (CMS_User table) or in some custom table/custom class with a linkage to a user (recommended).

Best regards,
Jan Hermann

1 votesVote for this answer Unmark Correct answer

Recent Answers


Jan Hermann answered on April 11, 2016 12:16

Hello,

you can for instance log the IP addresses during the authentication and then add a check if the IP of a request matches last logged IP address and logout the user if it does not.

Best regards,
Jan Hermann

0 votesVote for this answer Mark as a Correct answer

rajiv kumar answered on April 11, 2016 13:29

Hi Jan Hermann,

I have already tired it, I'm writing it in a Scheduler task Unable to get the User status whether the User is Authenticated or not. And the User Details like User Name,IP Address of the User. HttpContext is getting Null.

Thanks & Regards Rajiv

0 votesVote for this answer Mark as a Correct answer

rajiv kumar answered on April 11, 2016 14:25

Okay Thanks. It's working!!!

Best Regards,

Rajiv Kumar N

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.