OnAuthenticate Event  
 

The client has requested authentication with the specified username and password.

Syntax

Sub object_OnAuthenticate ( [Index As Integer,] ByVal ClientId As Variant, ByVal HostName As Variant, ByVal UserName As Variant, ByVal Password As Variant )

Parameters

ClientId
An integer value which uniquely identifies the client session.
HostName
A string that specifies the host name that the client used to establish the connection.
UserName
A string that specifies the user name provided by the client.
Password
A string that specifies the password provided by the client.

Remarks

The OnAuthenticate event occurs when the client has included authentication credentials with its request. The event handler can call the Authenticate method to authenticate the client session. If the client session is not authenticated, the server will send an error response to the client and close the connection.

In most cases, a client will not provide credentials unless the server indicates that they are required to access a specific resource. If you wish to password protect documents in a specific folder, use the AddPath method to create a virtual path to the folder and include the httpAccessProtected permission. The server will automatically require the client to provide credentials when accessing those documents. To require authentication for a specific resource, implement an OnCommand event handler and check the value of the IsAuthenticated property when that resource is requested. If the property returns False, then use the RequireAuthentication method to indicate to the client that it must provide authentication credentials.

If the application has created one or more virtual users using the AddUser method and/or the LocalUser property has been set to True, it is not necessary to implement an OnAuthenticate handler unless you also wish to perform custom authentication for specific users.

See Also

AddPath Method, AddUser Method, Authenticate Method, RequireAuthentication Method, OnCommand Event