Topic "WebDav Authentication Issue in .net"

Author Message
Tim Belcher
[View user's profile]

Joined: 2017-01-12
Posts: 1
Location: Ferrum, Virginia USA
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 = "",
PortNumber = 443,
UserName = "myusername",
Password = "mypassword",
WebdavSecure = true,

using (Session session = new Session())
// Connect

// 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?

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Please attach a complete session log file both for successful session in WinSCP GUI and failing session in .NET assembly (Session.SessionLogPath).

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License