When the username or password is wrong, the onSuccessFunction is called. And the next function is throwing an SessioNotFoundException.
table := TDataTable.Create('Clients');
adapter := TRemoteDataAdapter.Create('http://localhost:7099/BIN');
adapter.onLoginNeeded := procedure(aCallback: TProcedure)
begin
adapter.login('User='+ aUsername + ';Password='+ aPassword +';Domain=PCTrade Sample',
procedure
begin
ShowMessage('Login Success');
if assigned(aCallback) then
aCallback;
end,
showError);
end;
adapter.getData(table, CreateRequestInfo(true, -1, '', []),
procedure
begin
divOutput.InnerHTML := 'GetData Success' + '<br/>';
end,
procedure(msg: TMessage; e: TError)
begin
divOutput.InnerHTML := e.Name + ': ' + e.Message + '</br>' + msg.GetErrorMessage;
end);
Is there a way to check if username or password is wrong? I would like to show the user a proper message.