CHttpServer::GetVirtualHostName Method  
 
INT GetVirtualHostName(
  UINT nHostId,  
  LPTSTR lpszHostName,  
  INT nMaxLength  
);
INT GetVirtualHostName(
  UINT nHostId,  
  CString& strHostName  
);

Return the hostname associated with the specified virtual host ID.

Parameters

hServer
The server handle.
nHostId
An integer value which identifies the virtual host.
lpszHostName
A null-terminated string buffer that will contain the virtual host name, terminated with a null character. It is recommended that this buffer be at least 64 characters in length. If this parameter is NULL, the method will return the length of the virtual hostname. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters can be copied into the string buffer, including the terminating null character. If the lpszHostName parameter is NULL this value must be zero.

Return Value

If the method succeeds, the return value is the number of characters copied into the string buffer, not including the terminating null character. If either the server handle or the host ID is invalid, or the buffer is not large enough to store the complete hostname, the method will return a value of zero.

Remarks

The GetVirtualHostName method returns the primary hostname associated with the specified virtual host ID. This is the same hostname that was specified when the virtual host was added to the server configuration using the AddVirtualHost method. To obtain the hostname that was used by the active client session to connect to the server, use the GetClientVirtualHost method.

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

AddVirtualHost, AddVirtualHostAlias, DeleteVirtualHost, GetClientVirtualHost, GetVirtualHostId