Topic Path: Symbol Reference > Classes > TIdCustomHTTP Class > TIdCustomHTTP Events > OnRedirect Event
ContentsIndexHome
PreviousUpNext
TIdCustomHTTP.OnRedirect Event

Event handler triggered for redirect requests.

property OnRedirect: TIdHTTPOnRedirectEvent;
Parameters 
Description 
Sender 
Client triggering the event.
 
Dest 
URL for the new resource location.
 
NumRedirect 
An accumulator for the number of redirection requests.
 
Handled 
Indicated that redirects should be handled.
 
VMethod 
HTTP method to be used to fulfill the redirect. 

OnRedirect is a TIdHTTPOnRedirectEvent property that represents the event handler used when the HTTP client receives a redirection ResponseCode in the Response for an HTTP Request

OnRedirect is signalled during handling of an HTTP Response in the DoRequest method when the ResponseCode contains a value in the range 300-307, and the Response contains a Location header. 

When HandleRedirects is True, and the number of active redirects does not exceed RedirectMaximum, the event handler is signalled to allow the HTTP client to handle any processing required for the Location, Method, or current number of redirection requests. If the client is not Disconnected, the pending redirection request is automatically executed using a nested call to DoRequest. 

When HandleRedirects is False, the event handler is signalled to allow the HTTP client to handle all aspects of the redirection request. If the redirection request is not handled, an EIdProtocolReplyError exception will be raised. 

An Application must assign a procedure to the event handler in order to respond to the event notification. The event handler procedure can used to alter the redirection location specified in Dest, or to change the HTTP method for a pending redirection request. The event handler procedure should also set Handled to True to indicate that the redirection request can/should be allowed for the client.

Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.