Topic "How can I use property of "advance site setting--> Environment-->directory-->Remort Directory" .net"

Author Message
ashok
[View user's profile]

Joined: 2017-03-16
Posts: 2
How can I use property of "advance site setting--> Environment-->directory-->Remote Directory" using .net assembly.

It works with winscp client but not with .net assembly

Issue which I'm facing is, using hostname, userID and password it opens a folder but I have to navigate to virtual path which contains some positioning parameters in it. so how can I do the same? any suggestions or help? I saw some options to change directory but this is not an option in .net

code sample:
sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp,
FtpSecure = FtpSecure.Explicit,

HostName = HostName,
PortNumber = 21,
UserName = userName,
Password = Password,
TlsHostCertificateFingerprint = (string)Dts.Variables ["User::SshHostKeyFingerprintEDS"].Value,

FtpMode = FtpMode.Passive,
};
using (Session session = new Session())
{
session.ExecutablePath = @"C:\Program Files (x86)\WinSCP\WinSCP.exe";
session.Open(sessionOptions);
string _localPath = @"LocalPath" + providerCode + @"\*";

TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FilePermissions = null; // This is default
transferOptions.PreserveTimestamp = false;

TransferOperationResult transferResult;

transferResult = session.PutFiles(_localPath, "/abc/xxx/yyy/", false, transferOptions);

Here I'm getting error and error message is:

Error transferring file LocalPath_along_with_file_name.
Real path and requested remote path do not match: "/abc" ReceiverId: "xxx" FileName: "yyy" RefNo: "TCPIP/" "/acb/ReceiverID/FileName/"
Copying files to remote side failed.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26553
Location: Prague, Czechia
What is "positioning parameters"?

WinSCP .NET assembly does not have a concept of working directory. You simply use the absolute paths in all calls.
ashok
[View user's profile]

Joined: 2017-03-16
Posts: 2
martin wrote:
What is "positioning parameters"?

WinSCP .NET assembly does not have a concept of working directory. You simply use the absolute paths in all calls.


Has I said they are using some virtual path means its not a physical location. what is the absolute path means is it like hostname/path?

Thanks for reply
qzr2fr
[View user's profile]
Donor
Joined: 2017-03-16
Posts: 2
Location: California
Ashok is able to use the winSCP client from the same server that he is running the .NET script and we can connect with no issues. We have worked with the server company and they are saying the error is coming from winSCP not from their FTP server. This is when we get the "Real path and requested remote path do not match" error. When we put "/abc/xxx/yyy" in the winscp client we connect although the real directory is only "abc". The code below is from the receiving FTP server. I was told there are no errors on there side except for the "Client Closed the Connection". Does this help you with our issue?

--------------------------------------------------------------
elftpp112a 10:54:54.770 INFO IT85928-P25021: Command(CWD), Argument(/abc/xxx/yyyy/)
elftpp112a 10:54:54.771 INFO IT85928-P25021: 250: REQUEST FILE COMPLETED
elftpp112a 10:54:54.771 INFO IT85928-P25021: (POSITIVE COMPLETION, FILE SYSTEM)
elftpp112a 10:54:54.771 INFO IT85928-P25021: 250 SenderId: "abc" ReceiverId: "xxx" FileName: "yyyy" RefNo: "TCPIP" STRIPLF.
elftpp112a 10:54:54.772 INFO IT85928-P25021: waitForRequest...
elftpp112a 10:54:54.834 INFO IT85928-P25021: Command(PWD), Argument()
elftpp112a 10:54:54.834 INFO IT85928-P25021: 257: PATHNAME CREATED
elftpp112a 10:54:54.835 INFO IT85928-P25021: (POSITIVE COMPLETION, FILE SYSTEM)
elftpp112a 10:54:54.835 INFO IT85928-P25021: 257 SenderId: "abc" ReceiverId: "xxx" FileName: "yyyy" RefNo: "TCPIP" STRIPLF
elftpp112a 10:54:54.835 INFO IT85928-P25021: waitForRequest...
elftpp112a 10:54:56.253 ERROR IT85928-P25021: FTPServer: IOException, Client Connection closed
elftpp112a 10:54:56.254 INFO IT85928-P25021: FtpServerProtocol close
elftpp112a 10:54:56.254 INFO IT85928-P25021: FtpServerProtocolInterpreter: closing
elftpp112a 10:54:56.254 INFO IT85928-P25021: TotMem: 66060288 UsedMem: 52314704 PctMem: 79% Threads: 8
**************************** Bottom of Data ****************************
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26553
Location: Prague, Czechia
Absolute path is like /abc/xxx/yyyy/, i.e. what you have in the code already.

If you have problem, we need to see a complete session log file from both GUI and the .NET code.
qzr2fr
[View user's profile]
Donor
Joined: 2017-03-16
Posts: 2
Location: California
I have attached both the client log (which is successful) and the script log (which is not). I hope this helps and thanks again for looking at this for us.
ScriptLog.txt (8.96 KB) Private file

Description: This is the .net script log.

ClientLogChange.log (26.84 KB) Private file

Description: This is the client log.

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26553
Location: Prague, Czechia
I do not think your server is compatible with WinSCP.
I'll try to implement some workaround. I'll contact you shortly.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26553
Location: Prague, Czechia
I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26553
Location: Prague, Czechia
This issue has been added to the tracker:
https://winscp.net/tracker/show_bug.cgi?id=1518
Advertisements

You can post new topics in this forum






Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License