CHttpServer::GetVirtualHostId Method  
 
UINT GetVirtualHostId(
  LPCTSTR lpszHostName,  
  UINT nHostPort  
);

Return the virtual host ID associated with the specified hostname.

Parameters

lpszHostName
A string that specifies the virtual host name.
nHostPort
An optional integer value which specifies the port number for the virtual host. If this parameter is specified it must be the same value as the original port number that the server was configured to use.

Return Value

If the method succeeds, the return value is the host ID that uniquely identifies the virtual host. If the server handle is invalid, or there is no virtual host with the specified name, the method will return VIRTUAL_HOST_UNKNOWN. If the method fails, the last error code will be updated to indicate the cause of the failure.

Remarks

The GetVirtualHostId method is used to obtain the unique virtual host ID that is associated with a specific hostname. This method will match both the primary virtual hostname added using the AddVirtualHost method, as well as any aliases that were added using the AddVirtualHostAlias method. To obtain the virtual host ID associated with the active client session, use the GetClientVirtualHostId method.

The nHostPort parameter should either be omitted or specified with the same port number that the server was configured to use. Port-based virtual hosting is currently not supported and this parameter is included for future use.

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, GetClientVirtualHostId, GetVirtualHostName