.NET remobjects documentation on LoginNeededEventArs

Is there documentation on the LoginNeededEventArgs class?

The online documentation yields little: Remoting SDK for .NET

My OnLoginNeeded function performs a task which does not require a GUI. It uses some kind of client access token.
However I notice that this function gets called repeatedly when the login fails
Possibly the Retry parameter needs to be set to false.

Regards,
Frederic

Hi,

Check ClientChannel.OnLoginNeeded article.

We use such code in samples:

private void ClientChannel_OnLoginNeeded(object sender, LoginNeededEventArgs e)
{
    // Performing login
    if (this.LogOn(Properties.Settings.Default.UserId, Properties.Settings.Default.Password))
    {
        e.Retry = true;
        e.LoginSuccessful = true;
        return;
    }

    String lUserId;
    String lPassword;

    LogOnForm lLoginForm = new LogOnForm();

    if (lLoginForm.ShowDialog() != true)
    {
        MessageBox.Show("Login cancelled");
        return;
    }
    lUserId = lLoginForm.UserId;
    lPassword = lLoginForm.GetPassword();

    if (this.LogOn(lUserId, lPassword))
    {
        e.Retry = true;
        e.LoginSuccessful = true;
    }
    else
        MessageBox.Show("Login failed");
}

Hello Evgeny,

My code is very similar. For failed logins I do not change the Retry or LoginSuccesful attribute.

private void ClientChannel_OnLoginNeeded(object sender, RemObjects.SDK.LoginNeededEventArgs e)
{
  if (roCon_ == null)
    return;
  // Performing login
  bool bLoginOK = this.performLogin(true);
  if (bLoginOK)
  {
    e.Retry = true;
    e.LoginSuccessful = true;
    return;
  }
}

However I see many Login calls per second from the same client. I am wondering where it comes from.

Maybe my client code misbehaves but it is hard to identify this.
It would be very useful for me if I could know which RO function call triggered the Login call.

p.s. I don’t see information on the LoginNeededEventArgs class properties in the link you referred to
Did you mean the paragraph OnLoginNeeded? I can’t find the explanation on the “Retry” and “LoginSuccesful” (the latter obvious enough IMO).

Hi,

Check

protected void TriggerOnLoginNeeded(Exception exception, out Boolean loginSuccessful)
{
        if (this.OnLoginNeeded == null)
        {
                loginSuccessful = false;
                return;
        }

        LoginNeededEventArgs lEventArgs = new LoginNeededEventArgs(exception);
        this.OnLoginNeeded(this, lEventArgs);

        loginSuccessful = lEventArgs.LoginSuccessful;
}
catch (SessionNotFoundException e)
{
        Boolean loginAttemptResult;
        this.TriggerOnLoginNeeded(e, out loginAttemptResult);
        if (loginAttemptResult)
        {
                requestStream.Seek(0, SeekOrigin.Begin);
                retry = true;
        }
        else
        {
                throw;
        }
}