Changing folder after session opened (443 protocol to 80)

Advertisement

maui
Joined:
Posts:
2

Changing folder after session opened (443 protocol to 80)

I am currently using this session options
var sessionOptions = new SessionOptions
{
    Protocol = Protocol.Webdav,
    WebdavSecure = true,
    PortNumber = 443,
    HostName = hostname,
    UserName = username,
    Password = password,
};
The hostname format is something like:
example.com/fileshare/remote.php/dav/files/
The connection was successful but when I tried using any method inside (e.g. PutFiles) I kept on getting the 404 error. The suspicions rose from when I do the following:-

I tried adding the RootPath but it wont change to the desired folder:
RootPath = "/TMUser"
Error:
Error changing directory to '/TMUser'
Then I check for the homepath:
/fileshare/remote.php/dav/files/:443
and I realised I saw this when using the GUI too, what I did when using the GUI was change the directory using the 'Open Directory' button from
/fileshare/remote.php/dav/files/:443
to
/fileshare/remote.php/dav/files/TMUser
and succeed. Is there any options to do these inside the code?
Btw I just found this library a few hours ago.

Server is using Centos 7, and yes the port used is 80 inside the server but was set to 443 via router. I just finished searching a bit, so the issue is probably because of WinSCP lack concept of working directory? So I need to use the absolute path? hmm..
So something like this?
/var/www/fileshare/data
I tried, and got error
405 Method Not Allowed
hmmmm.. maybe im missing something but I'm not sure what it is.

3.jpg

Reply with quote

Advertisement

maui
Joined:
Posts:
2

Re: Changing folder after session opened (443 protocol to 80)

I got it! I set the RootPath to the full path:
RoothPath = "/fileshare/remote.php/dav/files/TMUser/"
I'm gonna leave this here in case anyone is having the same issue as me~
Oh, maybe this info is too late but I am trying to access NextCloud app in the server..

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
37,591
Location:
Prague, Czechia

Re: Changing folder after session opened (443 protocol to 80)

The SessionOptions.RootPath should be root of your WebDAV server (maybe /fileshare/remote.php/dav/?). It does not have to be a full transfer destination path (though it does no harm).

The SessionOptions.HostName should be only example.com, not example.com/fileshare/remote.php/dav/files/.

Reply with quote

Advertisement

You can post new topics in this forum