http OnProxyAuthenticationRequest event
Return to Introduction  Previous page  Next page
Applies to
acHTTP, acAutoUpgrader and acWebImage components.  

  TacHTTPProxyAuthenticationRequestEvent = procedure(Sender: TObject;  
     var ProxyUsername, ProxyPassword: String;  
     var TryAgain: Boolean) of object;  
property OnProxyAuthenticationRequest: TacHTTPProxyAuthenticationRequestEvent;  

The OnProxyAuthenticationRequest event should be used to prompt users for their username/password to access the Web via secure proxy server which requires authentication.  
Write this event to prompt and specify the ProxyUsername and ProxyPassword parameters, required for the proxy authentication, and set TryAgain parameter to True, to retry the HTTP query with provided login information.  
tip Alternatively you can specify ProxyUsername and ProxyPassword properties in the Proxy structure, before the request. In case if specified username and password is okay, the OnProxyAuthenticationRequest event will not occur.  
When you specify ProxyUsername and ProxyPassword parameters in this event — they also will be put to the Proxy structure, to be used on next HTTP request.  

iiwarning If your proxy server uses some "challenge-response" authentication scheme — please make sure that ioKeepConnection option of the InternetOptions is set to True. Otherwise, connection with proxy could be dropped.  
iiwarning If you leave this event unhandled (if you set TryAgain parameter to False), the component will generate error code #407 (Proxy Authentication Required), which will be passed to OnHTTPError event.  

See also
Proxy and InternetOptions properties;  
OnHTTPError event;  
HTTP Status Codes.