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

Advertisement

ashok
Joined:
Posts:
2

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

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.

Reply with quote

Advertisement

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

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

What is "positioning parameters"?

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

Reply with quote

ashok
Joined:
Posts:
2

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

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

Reply with quote

qzr2fr
Donor
Joined:
Posts:
2
Location:
California

More Information on Error

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 ****************************

Reply with quote

martin
Site Admin
martin avatar

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

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.

Reply with quote

Advertisement

qzr2fr
Donor
Joined:
Posts:
2
Location:
California

Attached Session Logs

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.

Reply with quote

martin
Site Admin
martin avatar

Re: Attached Session Logs

I do not think your server is compatible with WinSCP.
I'll try to implement some workaround. I'll contact you shortly.

Reply with quote

martin
Site Admin
martin avatar

Re: Attached Session Logs

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum