SocketTools .NET Edition

HttpServer.RequireAuthentication Method (Int32)

Send a response to the client indicating that authentication is required.

[Visual Basic]
Overloads Public Function RequireAuthentication( _
   ByVal clientId As Integer _
) As Boolean
[C#]
public bool RequireAuthentication(
   int clientId
);

Parameters

clientId
An integer that identifies the client session.

Return Value

A boolean value which specifies if the response was sent to the client. A return value of true specifies that the operation was successful. If an error occurs, the method returns false and the application should check the value of the LastError property to determine the cause of the failure

Remarks

The RequireAuthentication method can be used within an OnCommand event handler to indicate to the client that it must provide a username and password to access the requested resource. The client should respond by issuing another request that includes the required credentials. To determine if a client has included valid credentials with its request, check the value of the IsAuthenticated property.

Some clients may require that the session be secure if authentication is requested or display warning messages to the user if the connection is not secure. If your application will require clients to authenticate before accessing specific resources, it is recommended that you enable security by setting the Secure property to True prior to starting the server.

See Also