Share via


xSession.userId Method

Definition

Retrieves the user ID that this session is logged on with.

public:
 virtual System::String ^ userId();
public virtual string userId ();
abstract member userId : unit -> string
override this.userId : unit -> string
Public Overridable Function userId () As String

Returns

The ID for the user of the session.

Remarks

The following example determines whether a particular user is online.

server static boolean isUserOnline(userId userId) 
{ 
    xSession    session; 
    int counter; 
    int maxSessions = Info::licensedUsersTotal(); 
    if (!userId) 
    { 
        return false; 
    } 
    for(counter = 1; counter < maxSessions;counter++) 
    { 
        session = new xSession(counter, true); 
        if(session && session.userId() == userId) 
        { 
            return true; 
        } 
    } 
    return false; 
}

Applies to