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: WebDav Authentication Issue in .net

Please attach a complete session log file both for successful session in WinSCP GUI and failing session in .NET assembly (Session.SessionLogPath).
Tim Belcher

WebDav Authentication Issue in .net

hen using the Windows interface of WinSCP 5.9.3, I can connect to server and send files, using WebDAV over port 443 without issue. I have generated the .net code using the Manage --> Generate Session/URL code, and .NET assembly tab and have copied that code to my .net project as follows (I have not included the real server, username or password below):

/ Set up session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Webdav,
HostName = "my.targetserver.com",
PortNumber = 443,
UserName = "myusername",
Password = "mypassword",
WebdavSecure = true,
};

using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);

// Your code
}

However, when the code reaches the session.Open line of code, I get:
SessionRemoteException was caught. Authentication failed. Could not authenticate to server. rejected Basic challenge. Connection failed.

The hostname in my code is correct.
The username in my code is correct.
The password in my code is correct.
The code was copied from the Manage, Generate tab as noted above.

Any ideas that might help me get this resolved?

Thanks,
Tim