ICredentials.ForceError

Syntax

ForceError: Boolean;

Description

The ForceError property determines login that is known to be unsuccessful.

Comments

By default this property is set to False. If the value is True, the credentials are treated as incorrect. When IMetabaseDefinition.Open is called using the credentials known to be incorrect, the login failure record is displayed in the access protocol. The property is the means of logon failure logging.

The ICredentials.ErrorMessage property needs to be used for adding the comment to the access protocol.

Example

In the current example the connection to the "student" scheme under the UserTest user account is established.

Sub UserProc;
Var
    metabase: IMetabase;
    package: ISecurityPackage;
    credentials: IPasswordCredentials;
    definition: IMetabaseDefinition;
Begin
    definition := MetabaseManagerFactory.Active.Definitions.FindById("student");
    package := MetabaseManagerFactory.Active.Packs.FindById(definition.SecurityPackage).Package;
    credentials := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
    credentials.UserDescription := "MyDescription";
    credentials.UserOS := "MyUserOS";
    credentials.UserName := "UserTest";
    credentials.Password := "UserTest";
    credentials.ForceError := True;
    credentials.ErrorMessage := "Login known to be unsuccessful";
    Try
        metabase := definition.Open(credentials);
    Except
        On E: Exception Do
        WinApplication.InformationBox(E.message);
    End Try;
End Sub UserProc;

On executing the example the (Incorrect user name/password) exception is handled. Login failure record is added to the access protocol.

See also:

ICredentials