Unable to overwrite file using WinSCP dll with WebDAV
Hi,
Trying to upload and overwrite a file on our server over WebDAV protocol, but just getting a "500 internal server error"-message. Doing the same on the WinSCP GUI works like it should.
Uploading a new file works like a charm as well. Credentials on server is double-checked.
Generated script from client, and just used the example from website, with the addition by adding
The complete error-message:
Does anyone have some hints on what I should look for?
Thanks!
Trying to upload and overwrite a file on our server over WebDAV protocol, but just getting a "500 internal server error"-message. Doing the same on the WinSCP GUI works like it should.
Uploading a new file works like a charm as well. Credentials on server is double-checked.
Generated script from client, and just used the example from website, with the addition by adding
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"); } }
I also tried usingWinSCP.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.
Does anyone have some hints on what I should look for?
Thanks!