CHttpClient::GetRedirectUrl Method  
 
INT GetRedirectUrl(
  LPTSTR lpszResource,  
  INT nMaxLength  
);
INT GetRedirectUrl(
  CString& strResource  
);

The GetRedirectUrl method returns the URL for a redirected resource.

Parameters

lpszResource
A null-terminated string buffer which will contain the URL of the redirected resource when the method returns. The string will be null terminated and the buffer must be large enough to accommodate the entire URL or the method will fail. This parameter cannot be a NULL pointer. An alternate form of the method accepts a CString variable which will contain the URL.
nMaxLength
The maximum number of characters that may be copied into the string buffer. This value must be greater than zero.

Return Value

If the method succeeds, the return value is the length of the URL. A return value of zero indicates that the request was not redirected. If the method fails, the return value is HTTP_ERROR. To get extended error information, call GetLastError.

Remarks

This method returns the complete URL for a request which has been redirected to a different resource. This is useful for applications which do not wish to use automatic redirection and instead prefer to handle the redirection by establishing a new connection by passing this value to the ConnectUrl method.

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: cshtpv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also