Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review

Grégory Catto

Resolve WebDav 405 Method not allowed problem in WinSCP

In the WinSCP parameters, you can try to set the true TLS/SSL version of the server.
Try TLS 1.1 to 1.2. It can resolve the problem

supermankelly wrote:

why is the generated code still broken for WebDAV?

It's not broken.
There's no way WinSCP can know that the root is not accessible with WebDAV.

I wish I has found this yesterday. I spent half the day working this out myself. Mine only worked with user password also which is also missing from generated code.

This was post was raised 2 years ago... why is the generated code still broken for WebDAV?

Hi Martin,

you were absolutely right.

By adding

RootPath = "/remote.php/webdav"

to the Powershell script or adding the root folder to the batch code:

open davs://

winscp successfully connects to WebDav Service.

Thank you for your quick help :D

Webdav script 405 Method Not Allowed

When used over GUI everything works fine. When you open an already existing Session in a batch script everything works fine.

But when you generate your session code to do a batch or powershell script the "405 Method not allowed" error is shown.

Here is a working example:

option batch on

option confirm off
open CloudSession
lcd test
cd test
get *.*

When i connect to the session via gui and generate a session code it looks like this:

open davs://

When connecting with

winscp> open davs://

Verbinde mit entferntem Rechner...
405 Method Not Allowed
Verbindung fehlgeschlagen.

Same error on this Powershell code:

# WinSCP .NET assembly laden

Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

# Sitzungsoptionen konfigurieren
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Webdav
    HostName = ""
    PortNumber = 443
    UserName = "user"
    Password = "password"
    WebdavSecure = $True
    TlsHostCertificateFingerprint = "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"

$session = New-Object WinSCP.Session

Ausnahme beim Aufrufen von "Open" mit 1 Argument(en): "405 Method Not Allowed Verbindung fehlgeschlagen."

Any ideas what could be wrong here?