WebDav Authentication Issue in .net

Advertisement

Tim Belcher
Joined:
Posts:
1
Location:
Ferrum, Virginia USA

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

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

Reply with quote

Advertisement

You can post new topics in this forum