CHttpServer::GetClientUserName Method  
 
INT GetClientUserName(
  UINT nClientId,  
  LPTSTR lpszUserName,  
  INT nMaxLength  
);
INT GetClientUserName(
  UINT nClientId,  
  CString& strUserName  
);

Return the user name associated with the specified client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
strUserName
A null-terminated string buffer that will contain the user name associated with the client session. This buffer must be large enough to store the complete user name, including the terminating null character. This parameter cannot be NULL. An alternate version of this method accepts a CString object if it is available.

Return Value

If the method succeeds, the return value is non-zero. If the client ID does not specify a valid client session, or the client has not authenticated itself, the method will return zero and the lpszUserName parameter will be set to an empty string.

The IsClientAuthenticated method can be used to determine if the client has provided credentials as part of the request made to the server.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

AuthenticateClient, GetClientAccess