CHttpServer::GetCommandResource Method  
 
INT GetCommandResource(
  UINT nClientId,  
  LPTSTR lpszResource,  
  INT nMaxLength  
);
INT GetCommandResource(
  UINT nClientId,  
  CString& strUrlPath  
);

Return the URL path for the resource requested by the client.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszResource
A null-terminated string buffer that will contain the URL path provided by the client for the current command. The string buffer will be null terminated and must be large enough to store the complete path. If this parameter is NULL, the method will only return the length of the path. 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 lpszResource 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 GetCommandResource method returns the URL path that the client provided to access the requested resource. The path will not include the URI scheme, user credentials or query parameters. 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 require the complete URL, not just the path to the resource, use the GetCommandUrl 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 a 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, GetCommandQuery, GetCommandUrl, RedirectRequest