Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Jim Bate

C#

The .NET code tab got me past that. Thanks. I had missed that.
martin

Re: WinSCPNet.dll 1.14.0.13797 from C#

What "escaping" did you try?
Use the generated code from the ".NET assembly code" tab.
If it does not work, please post full code both from a working GUI session and from the code generated by the GUI for the same session.
https://winscp.net/eng/docs/ui_generateurl#code
Jim Bate

WinSCPNet.dll 1.14.0.13797 from C#

Have tried password with escaped password as generated on URL/Code page and without. both the same result:
024-02-12 14:56:19.921 Script: Using username "xxxxxxx".
. 2024-02-12 14:56:19.946 Server offered these authentication methods: publickey,gssapi-with-mic,keyboard-interactive,password
. 2024-02-12 14:56:19.946 Using SSPI from SECUR32.DLL
. 2024-02-12 14:56:19.946 Trying gssapi-with-mic...
. 2024-02-12 14:56:19.946 Attempting GSSAPI authentication
. 2024-02-12 14:56:19.988 GSSAPI authentication initialisation failed
. 2024-02-12 14:56:19.988 No credentials are available in the security package.
. 2024-02-12 14:56:19.988 Attempting keyboard-interactive authentication
. 2024-02-12 14:56:20.014 Prompt (keyboard interactive, "SSH server: Password authentication", <no instructions>, "Password: ")
. 2024-02-12 14:56:20.014 Using stored password.
< 2024-02-12 14:56:20.014 Script: Authenticating with pre-entered password.
. 2024-02-12 14:56:23.034 Keyboard-interactive authentication failed
! 2024-02-12 14:56:23.034 Access denied
< 2024-02-12 14:56:23.034 Script: Access denied.
. 2024-02-12 14:56:23.034 Server offered these authentication methods: publickey,gssapi-with-mic,keyboard-interactive,password
. 2024-02-12 14:56:23.034 Attempting keyboard-interactive authentication
. 2024-02-12 14:56:23.058 Prompt (keyboard interactive, "SSH server: Password authentication", <no instructions>, "Password: ")
. 2024-02-12 14:56:23.058 Prompting user for the credentials.
. 2024-02-12 14:56:23.058 Prompt cancelled.
. 2024-02-12 14:56:23.058 User aborted at keyboard-interactive authentication prompt
. 2024-02-12 14:56:23.058 Attempt to close connection due to fatal exception:
* 2024-02-12 14:56:23.058 **Connection has been unexpectedly closed.** Server sent command exit status 0.
. 2024-02-12 14:56:23.058 Closing connection.
< 2024-02-12 14:56:23.059 Script: Connection has been unexpectedly closed. Server sent command exit status 0.
< 2024-02-12 14:56:23.059 Authentication log (see session log for details):
< 2024-02-12 14:56:23.059 Using username "xxxxxxx".
< 2024-02-12 14:56:23.059 Access denied.
< 2024-02-12 14:56:23.059

c# code
using (Session session = new Session())
{
    SessionOptions Opts = new SessionOptions();
    Opts.Protocol = Protocol.Sftp;
    Opts.HostName = "xxxxxxxx";
    Opts.UserName = sftpUser;
    Opts.Password = sftpPswd;
    Opts.PortNumber = iftpPort;
    Opts.SshHostKeyFingerprint = fingerprint;
    session.SessionLogPath = @"WinScp.log";
    string fullPath = uriString; // uri.LocalPath + directory;
    session.Open(Opts);