SocketTools .NET Edition

HttpServer.OnAuthenticate Event

Occurs when the client has requested authentication with the specified username and password.

[Visual Basic]
Public Event OnAuthenticate As OnAuthenticateEventHandler
[C#]
public event OnAuthenticateEventHandler OnAuthenticate;

Event Data

The event handler receives an argument of type HttpServer.AuthenticateEventArgs containing data related to this event. The following HttpServer.AuthenticateEventArgs properties provide information specific to this event.

Property Description
ClientId Gets a value that uniquely identifies the client session.
HostName Gets the host name used by the client to establish the connection to the server.
Password Gets the password provided by the client for authentication.
UserName Gets the password provided by the client for authentication.

Remarks

The OnAuthenticate event occurs when the client has requested authentication by sending the USER and PASS command to the server. The event handler can call the Authenticate method to authenticate the client session. If the client is not authenticated, the server will send an error message to the client and terminate the session.

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.

This event handler will be invoked in the context of the worker thread that is managing the client session, not the thread that created an instance of the class. Because UI components should only be modified by the thread that created them, the event handler should never attempt to update the user interface directly.

See Also