CHttpServer::GetCommandUrl Method  
 
INT GetCommandUrl(
  UINT nClientId,  
  LPTSTR lpszUrl,  
  INT nMaxLength  
);
INT GetCommandUrl(
  UINT nClientId,  
  CString& strUrl  
);

Return the complete URL of the resource requested by the client.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszUrl
A pointer to a string buffer that will contain the URL provided by the client for the current command. The string buffer will be null terminated and must be large enough to store the complete URL. If this parameter is NULL, the method will only return the length of the URL. 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 that can be copied into the string buffer, including the terminating null character. If the lpszUrl parameter is NULL, this value should be zero. If this value is less than the length of the URL, the method will fail.

Return Value

An integer value which specifies the number of characters copied into the buffer, not including the terminating null character. If the method fails, the return value will be zero and the GetLastError method can be used to retrieve the last error code.

Remarks

The GetCommandUrl method returns the complete URL that the client provided to access the requested resource. The URL will include any query parameters that were specified by the client, but it will not include any user credentials. The GetCommandFile method can be used to determine the name of the local file on the server that will be accessed using this URL.

If you only require the URL path, without the URI scheme or the query parameters, use the GetCommandResource method.

This method should only be called after the client request has been received by the server, typically inside an OnCommand event handler. It should not be called inside an OnConnect event handler because the server has not processed the client request at that point.

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

GetCommandFile, GetCommandResource, RedirectRequest, OnCommand