Webdav script 405 Method Not Allowed



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://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.

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



Hi Martin,

you were absolutely right.

By adding

WebdavRoot = "/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


You can post new topics in this forum