Home > Software design >  WinSCP .NET Assembly impersonation issue: The stub received bad data
WinSCP .NET Assembly impersonation issue: The stub received bad data

Time:02-08

I have an .NET console app using WinSCP assembly version 5.19.5. The app is under impersonation in order to access files on NAS so that I set ExecutableProcessUserName and ExecutableProcessPassword for the Session object.

Dim sessionOptions As New SessionOptions
With sessionOptions
    .Protocol = Protocol.Sftp
    .HostName = _SFTPServer
    .UserName = _SFTPLoginID
    .Password = _SFTPLoginPwd
    .PortNumber = _SFTPPort
End With
Using session As New Session

    sessionOptions.SshHostKeyFingerprint =
        session.ScanFingerprint(sessionOptions, "SHA-256")

    session.ExecutableProcessUserName = _ServiceAccountUsername
    session.ExecutableProcessPassword =
        ConvertToSecureString(_ServiceAccountPassword)
    session.Open(sessionOptions)

It fails at session.Open with error:

The stub received bad data Any ideas? Thanks

CodePudding user response:

It seems that you need to specify the domain:
Stub received bad data?

session.ExecutableProcessUserName = "user@domain";
  •  Tags:  
  • Related