JavaScript Functions > Alphabetical Listing of Web Functions > web.setUser

web.setUser

Specifies a login string for a Web server.

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.

Return Values

Not applicable

Parameterization

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

General Information

The web.setUser 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.setUser 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.setUser statement containing the login details. However, there are some more stringent, authentication methods for which VuGen is unable to insert web.setUser statements. See User Authentication for more detail. 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 Run-Time 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: Example: web_set_user