OnRedirect Event (Windows 8)


Fires when a client sends an HTTP request that the server redirects to a new URL.

C/C++ Syntax

HRESULT OnRedirect(  
        IXMLHTTPRequest2 *pXHR,  
        const WCHAR *pwszRedirectUrl);  


The IXMLHTTPRequest2 object associated with this callback.

pwszRedirectUrl[in, string]
The new URL for the HTTP request.

Return Values

The value returned if successful.


If the request redirection is not permitted, you can call the Abort method on the HTTP request that pXHR points to.

IXMLHTTPRequest2 imposes a maximum of 10 redirections on any request. Any redirections above that limit generate an OnError event.

Applications have no access to the headers for redirections. Once the final redirection has completed and the final URL has been reached, the application receives an OnHeadersAvailable callback.


Implemented in: MSXML 6.0

Applies to


See Also

Abort Method (IXMLHTTPRequest2, Windows 8)
OnError Event (Windows 8)
OnHeadersAvailable Event (Windows 8)