Sets the password for user authentication. This setting is ignored if a user name and/or password is specified in the URL of a low-level call.
WebAPI.bdh
WebSetUserAuth( in sUsername : string allownull, in sPassword : string optional, in sUrl : string optional, in sRealm : string optional, in bReactiveOnly : boolean optional): boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
sUsername | User name. This parameter may be NULL. |
sPassword | Password. This parameter may be NULL (optional). |
sUrl | URL representing protection space for basic authentication (optional) |
sRealm | Realm for which to set authentication (optional). This realm then provides a special context for the username/password to a Web site. For example, www.MyCompany.com uses realm "www.MyCompany.com", whereas www.MyCompany.com/support uses realm "MyCompany support". |
bReactiveOnly | If this parameter is set to true (default is false), the user and password pair can only be used in a reaction to a 401 response from the server. |
Calling this function inserts the username/password pair into the authentication database used when a server requests basic authentication (code 401). On subsequent requests, the authentication header line will be added to the request headers automatically.
To set the default username password, call WebSetUserAuth("user1", "pass1");
To delete the default username/password, call WebSetUserAuth("", ""); This does not remove the entry from the authentication database.
To remove all cached authentication entries from the cookie database, call WebSetUserAuth(NULL, NULL);
In addition, you can add authentication entries directly to the authentication database by providing a protection space and the realm. For example, WebSetUserAuth("BasicAuthUser", "BasicAuthPass", "http://lab1/testsite/", "lab1");
dcltrans transaction TMyTransaction begin // Enable user authentication // User sends e-mail address as password WebSetUserAuth("steve", "steve@mydomain.com"); // Now send the request including username and password WebUrl("http://www.mydomain.com/", 0.0); // Disable user authentication WebSetUserAuth(NULL, NULL); end TMyTransaction;
WebAuth01.bdf
Ftp.sep