Share this page

# web.setUser

Specifies a login string for a web server.

Authentication Functions

## Syntax

    web.setUser( username, password, host:port );

Argument | Description
--- | ---
username | The name of the user making the connection. The username argument is limited to 127 characters.
password | The password of the user making the connection. The password argument is limited to 127 characters.
host:port | 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.setUser call. To specify a realm, add it before the server name: `web.setUser("<user name>", "<password>", "<realm name>\\<server name>:<port>");`

## Return Values

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

## Parameterization

The following arguments can be parameterized using standard parameterization: username, password, host:port

## General Information

The web.setUser function is a service function. For details, see Service Functions. It 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.setUser overrides the runtime proxy authentication settings for user name and password.

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

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.setUser has no effect if a proxy autoconfiguration file is specified in the runtime settings.

## Example

The following function was recorded by VuGen when a user logged on to the server called mansfield, using the standard HTTP port:

    web.setUser("usr", "userPwd", "mansfield:80");

For more options, see the C Language example in web_set_user.

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: