/// <summary>
        /// Save a session-state value with the specified userId.
        /// </summary>
        public static void SaveUserIdToSession(this WindowsLoginHandler handler, string userId)
        {
            if (handler.SessionHasUserId())
            {
                throw new ApplicationException("Id already exists in session.");
            }

            handler.Context.Session[userIdKey] = userId;
        }