I am creating a C# application that executes Linux command remotely.
Everything is fine with SSH.NET.
But when I enter wrong password it is not giving proper ERROR, just exception un-handed is the message that I am getting, and also "__No suitable authentication method found to complete authentication__."
But i just want to pop-up with a messagbox that re-enter user, something like that how can I overcome this.
Thanks & Regards
Avinash.
Comments: ** Comment from web user: avinashav **
I tried adding in ConnectionInfo.cs but it is not working.
error is specified at line which i have made BOLD.
please help me to handle exception.
try
{
// the exception to report an authentication failure with
SshAuthenticationException authenticationException = null;
// try to authenticate against none
var noneAuthenticationMethod = new NoneAuthenticationMethod(this.Username);
var authenticated = noneAuthenticationMethod.Authenticate(session);
if (authenticated != AuthenticationResult.Success)
{
__var failedAuthenticationMethods = new List<AuthenticationMethod>();__
if (TryAuthenticate(session, noneAuthenticationMethod.AllowedAuthentications.ToList(), failedAuthenticationMethods, ref authenticationException))
{
authenticated = AuthenticationResult.Success;
}
}
this.IsAuthenticated = authenticated == AuthenticationResult.Success;
if (!IsAuthenticated)
throw authenticationException;
}
finally
{
session.UserAuthenticationBannerReceived -= Session_UserAuthenticationBannerReceived;
session.UnRegisterMessage("SSH_MSG_USERAUTH_FAILURE");
session.UnRegisterMessage("SSH_MSG_USERAUTH_SUCCESS");
session.UnRegisterMessage("SSH_MSG_USERAUTH_BANNER");
}