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

Advertisement

alharlow
Joined:
Posts:
6
Location:
Lincoln, NE USA

.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;

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

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

Please attach both SessionLogPath and DebugLogPath logs.

Reply with quote

alharlow
Joined:
Posts:
6
Location:
Lincoln, NE USA

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

martin wrote:

Please attach both SessionLogPath and DebugLogPath logs.
  • WinSCPdebug.log (21.49 KB, Private file)
  • WinSCP.log (3.29 KB, Private file)

Reply with quote E-mail

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

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)

Reply with quote

Advertisement

You can post new topics in this forum