Sitecore licensing can be based on total number of concurrent user sessions. When Sitecore client concurrent user sessions limit reaches to its threshold value, next user who wants to login on Sitecore content tree/ desktop will be denied to login. User will get below message because Sitecore license has a concurrent number of users limitation:
Too many inactive and idle users can cause slowness to Sitecore client and you may also observe performance issues while doing content authoring. Most of the time users have a habit to exit Sitecore application by simple closing the browser window. Thus Sitecore client never gets a log off command from user manually and user session does not get killed immediately. Since Sitecore server never received a log off command, it waits until the user session time out occurs. Standard session timeout is 20 minutes.
To allow new users to login on Sitecore client, we have to kick inactive and idle user sessions. Follow below steps to kick inactive and idle user sessions manually:
Following code will kick Sitecore users if they are inactive or idle for a specified period of time:
Too many inactive and idle users can cause slowness to Sitecore client and you may also observe performance issues while doing content authoring. Most of the time users have a habit to exit Sitecore application by simple closing the browser window. Thus Sitecore client never gets a log off command from user manually and user session does not get killed immediately. Since Sitecore server never received a log off command, it waits until the user session time out occurs. Standard session timeout is 20 minutes.
To allow new users to login on Sitecore client, we have to kick inactive and idle user sessions. Follow below steps to kick inactive and idle user sessions manually:
- Login on Sitecore client. Please make sure that either you have login using admin credentials or you have admin privileges.
- Navigate to below url:
http://Sitecore-domain-path/Sitecore/shell/Applications/Login/Users/Kick.aspx
If you are using Sitecore 8 :
http://Sitecore-domain-path/sitecore/client/Applications/LicenseOptions/KickUser - You will get list of current user sessions (active and inactive) with login time and last request time.
- Select user who is inactive or idle and click on KICK button.
Following code will kick Sitecore users if they are inactive or idle for a specified period of time:
using System; using Sitecore.Web.Authentication; using System.Collections.Generic; namespace Sitecore { public class KickUserSession { private TimeSpan maximumIdleTime; public KickUserSession(string maximumIdleTime) { this.maximumIdleTime = TimeSpan.Parse(maximumIdleTime); } public void Run() { List<DomainAccessGuard.Session> userSessionList = DomainAccessGuard.Sessions; if (userSessionList != null && userSessionList.Count > 0) { foreach (DomainAccessGuard.Session userSession in userSessionList.ToArray()) { TimeSpan span = (TimeSpan)(DateTime.Now - userSession.LastRequest); if (span > this.maximumIdleTime) { DomainAccessGuard.Kick(userSession.SessionID); Sitecore.Diagnostics.Log.Audit("Kicked out user is : " + userSession.UserName, this); } } } } } }Source code and dll can be downloaded from GitHub.
- Copy Sitecore.KickUserSessionAgent.dll in /bin folder of Sitecore website.
- Add the following agent into the <scheduling> section in web.config:
<!-- Agent to kick users who are idle for 30 minutes --> <agent type=" Sitecore.KickUserSessionAgent.KickUserSession" method="Run" interval="00:05:00"> <param desc="maximumIdleTime">00:30:00</param> </agent>Comments and suggestions are most welcome. Happy coding!
0 comments :
Post a Comment