Webdav script 405 Method Not Allowed

Advertisement

StewieGriffin
Guest

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 *.*
close
exit

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

open davs://user:password@cloud.xxxxxx.com/

When connecting with winscp.com:

winscp> open davs://user:password@cloud.xxxxxx.com/
Verbinde mit entferntem Rechner...
405 Method Not Allowed
Verbindung fehlgeschlagen.
winscp>

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 = "cloud.xxxxxx.com"
    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?

Reply with quote

Advertisement

Guest

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://user:password@cloud.xxxxxx.com/remote.php/webdav

winscp successfully connects to WebDav Service.

Thank you for your quick help :D

Reply with quote

supermankelly
Joined:
Posts:
10
Location:
Essex

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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,263
Location:
Prague, Czechia

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.

Reply with quote

Advertisement

Grégory Catto
Guest

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

Reply with quote

Advertisement

You can post new topics in this forum