Call this method to assign a proxy server to be used for subsequent HTTP transactions.

bool SetProxy(
   LPCTSTR szProxy = NULL,
   short nProxyPort = 0 
) throw( );



A string containing the name of a proxy server. The proxy server name should not include a HTTP protocol prefix. For example, using "http://myproxyserver" will cause requests to fail, but SetProxy will not return false to indicate failure. This parameter defaults to NULL, which causes CAtlHttpClientT to retrieve proxy server information from the registry. See Remarks for more details.


The port number for the proxy server, typically 80. This argument is ignored if zero is used for szProxy.

Returns true on success, false on failure.

Calling this method causes all HTTP transactions to be routed through the given proxy server. Calling SetProxy with no arguments is recommended, because proxy server information will be retrieved from the registry instead of being hard-coded in the application. The registry key used to retrieve the proxy server settings is:


Community Additions