Post a reply

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

martin

Re: .NET assembly log file says User name: (Password: No, Key file: No, Passphrase: No)

I'm sorry, but I cannot imagine how these logs could have been produced by your code, unless the sUserName is null.

With this trivial code, basically identical to yours, just with explicit values:
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Ftp,
    FtpSecure = FtpSecure.Implicit,
    HostName = "hostname",
    UserName = "username",
    Password = "password",
};
 
using (Session session = new Session())
{
    session.SessionLogPath = "c:\\AKH\\WinSCP.log";
 
    // Connect
    session.Open(sessionOptions);
}

I get log like this:
> 2024-02-26 12:13:51.691 Script: open ftp://username:***@hostname -implicit -passive=1 -timeout=15
. 2024-02-26 12:13:51.691 --------------------------------------------------------------------------
. 2024-02-26 12:13:51.691 Session name: username@hostname (Ad-Hoc site)
. 2024-02-26 12:13:51.691 Host name: hostname (Port: 990)
. 2024-02-26 12:13:51.691 User name: username (Password: Yes, Key file: No, Passphrase: No)
alharlow

Re: .NET assembly log file says User name: (Password: No, Key file: No, Passphrase: No)

martin wrote:

Please attach both SessionLogPath and DebugLogPath logs.
martin

Re: .NET assembly log file says User name: (Password: No, Key file: No, Passphrase: No)

Please attach both SessionLogPath and DebugLogPath logs.
alharlow

.NET assembly log file says User name: (Password: No, Key file: No, Passphrase: No)

This is the continuation of my last topic. The user name and password are provided. When I run the process in VS debugger I see it work. I put the process in production and tells me no user name or password. In the debugger, I stop it just after sessionOptions is created and populated. Hovering over these variables shows the correct values. The WriteToLog method of course writes whatever to the program log file. Looking in there after the code finishes shows a blank line. The session.Open statement is where things fall apart.
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Ftp,
    FtpSecure =FtpSecure.Implicit,
    HostName = sHostName,
    UserName = sUserName,
    Password = sPassword
};
             
using (Session session = new Session())
{
    session.SessionLogPath = "c:\\AKH\\WinSCP.log";
 
    WriteToLog(sessionOptions.UserName + " " + sessionOptions.Password);
 
    // Connect
    session.Open(sessionOptions);
 
    // Download files
    TransferOptions transferOptions = new TransferOptions();
    transferOptions.TransferMode = TransferMode.Binary;