WebSetProxyAuthBasic Function

Action

Sets the password for basic proxy authentication login. Use empty strings or NULL values to disable proxy authentication.

Note: This function overrides the corresponding setting in the Simulation tab of the Profile Settings - Web dialog. In contrary to the WebSetProxyAuth function it does not change the credentials for a NTLM/Kerberos user authentication.

Include file

WebAPI.bdh

Syntax

WebSetProxyAuthBasic( in sUsername     : string allownull,
                      in sPassword     : string optional,
                      in sProxy        : string optional,
                      in bReactiveOnly : boolean optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sUsername User name for proxy authentication. This parameter may be NULL.
sPassword Password for proxy authentication (optional).
sProxy Proxy for which the username and password should be set (optional). If this parameter is omitted the username and password will be used for authentication after the next 407 response from the server.
bReactiveOnly If this parameter is set to true (optional; default is false), the user and password pair can only be used in a reaction to a 407 response from the server.

Calling this function inserts the username/password pair into the authentication database used when a server requests proxy authentication (code 407). On subsequent requests, the authentication header line will be added to the request headers automatically.

  • To set the default username password, call WebSetProxyAuthBasic("user1", "pass1");

  • To delete the default username/password, call WebSetProxyAuthBasic("", ""); This does not remove the entry from the authentication database.

  • To remove all cached authentication entries from the cookie database, call WebSetUse WebSetProxyAuthBasic rAuth(NULL);

  • In addition, you can add authentication entries directly to the authentication database by providing a protection space and the realm. For example, WebSetProxyAuthBasic ("BasicAuthUser", "BasicAuthPass", "proxy", false);

Example

dcltrans
  transaction TWebInit
  begin
    // Set up proxy connection using the WebSetting commands
    WebSetProxy(WEB_PROXY_HTTP, "proxy.mydomain.com", 80);
    WebSetProxyBypass(FALSE, NULL);

    // Set password used for authentication
    WebSetProxyAuthBasic("proxyuser", "proxypass", "proxy:80");
    WebSetProxyAuthBasic("proxyusersecure", "proxypasssecure",
  "proxy:443");
  end TWebInit;