Works like a charm now, thanks!
- T.Hylander
SessionOptions.RootPath
to "/webdav/files/Integrationer/Driftsstörningar"
.
session.RemoveMile([file])
but that throw the same error.
Session.SessionLogPath
:
transferOptions.OverwriteMode = OverwriteMode.Overwrite
.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Webdav,
HostName = "www.domain.se",
UserName = "User",
Password = "Password",
WebdavSecure = true,
TlsHostCertificateFingerprint = "00:00:00:00:00:00:00:00:00:00:00",
};
using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.OverwriteMode = OverwriteMode.Overwrite;
TransferOperationResult transferResult;
transferResult =
session.PutFiles(@"C:\temp\test.json", "/webdav/files/test/", false, transferOptions);
// Throw on any error
transferResult.Check();
// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
MessageBox.Show("Upload of " + transfer.FileName + " succeded");
}
}
WinSCP.SessionRemoteException: Error transferring file 'c:\temp\test.json'
500 Internal Server Error
at WinSCP.OperationResultBaseCheck()
at ProgramFormProgram.button2_Click(Object sender, EventArgs e) in c:\temp\Program\Form1.cs::row 220
Session.PutFileToDirectory
but that didn't change anything.