Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_set_user


Specifies a login string for a Web server.

C Language

int web_set_user( const char *username, const char *password, const char *[realm\\]host:port ); 

Java Language

int object.set_user( String username, String password, String host:port ); 
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
The name of the user making the connection. The username argument is limited to 127 characters.
The password of the user making the connection. The password argument is limited to 127 characters.

The URL of the server to log on to, and the port to use. (Format: "host:port"). For example: www.merc–int.com:8080

If no port is specified, the default port for the protocol is used (HTTP – 80, HTTPS – 443, FTP – 21). Specifying a port overrides the default for that protocol.

If an empty string ("") is passed, the username and password are applied to all domains unless a different user and password has been set for the domain with another web_set_user call.

To specify a realm, add it before the server name: web_set_user("<user name>", "<password>", "<realm name>\\<server name>:<port>");

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.


The following argument(s) can be parameterized using standard parameterization: username, password, host:port

General Information

The web_set_user function is a service function that specifies a login string and password for a Web server or proxy server. It can be called more than once if several proxy servers require authentication. web_set_user overrides the run–time proxy authentication settings for user name and password.

When you log onto a server that requires user and password validation, VuGen records a web_set_user statement containing the login details. However, there are some more stringent, authentication methods for which VuGen is unable to insert web_set_user statements. See User Authentication for more detail. In such cases, you can add web_set_user into your script manually.

If there is a specific authentication realm required, and VuGen either does not record it or records it together with other realms that are not required, you can use web_set_user to specify the realm. For example:

    web_set_user("my_user", "my_password", "T1Realm\\myserver:29918");

When you run the script, the user authorization is automatically submitted along with every subsequent request to that server. At the end of the script, the authorization is reset.

Limitation: web_set_user has no effect if a proxy autoconfiguration file is specified in Run-Time Settings.

This function is supported for all Web scripts.