HttpGetVirtualHostName Function  
 
INT WINAPI HttpGetVirtualHostName(
  HSERVER hServer,  
  UINT nHostId,  
  LPTSTR lpszHostName,  
  INT nMaxLength  
);

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 function will return the length of the virtual hostname.
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 function 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 function will return a value of zero.

Remarks

The HttpGetVirtualHostName function 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 HttpAddVirtualHost function. To obtain the hostname that was used by the active client session to connect to the server, use the HttpGetClientVirtualHost function.

Requirements

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

See Also