I could not use it in window service by c# (wodFTPServer)
I try to place the wodFTPServer component into my window service project, but it is a ActiveX component, it can't be initialized. How do I proccess it.
Waiting for your help.
Re: I could not use it in window service by c#
Hi,
Why don't you try using COM (.dll) instead?
Just add it as reference (Add Reference->Browse->System32->wodFtpd.dll), then initialize and declare the object by doing this:
[code]private wodFTPDComLib.wodFTPDComClass ftpd1 = new wodFTPDComLib.wodFTPDComClass();[/code]
Can you try something like that?
Regards,
Damba
Re: I could not use it in window service by c#
Thks, It is my careless when I reading the help doc. I didn't take notice of it.
I have resolved it, thanks again.
I go on my testing.
Re: I could not use it in window service by c#
Hi,
I have the another question when I using the clientFTP component(FtpDLX) for the encoding, My project is a multi-language project, but I can't recive the Asia(like chinese language=Gb2312 character)correctly. I try to encode it, but I'm failed.
How can I do? thank you.
regards,
shareach
Re: I could not use it in window service by c#
Shareach,
How exactly do you display directory listing?
Can you please try using DirItems collection and UnicodeName property?
I tried this on my side, and chinese names were displayed correctly.
Regards,
Damba
Re: I could not use it in window service by c#
Thanks for replay
I try to use the DirItems in DoneEvent follow the help doc:
In order to access this property and return list of the directory, you must call ListDir method first - so wodFtpDLX.NET can retrieve directory listing from the server. Once ListDir is called, and Done is fired - you can access this property.
I can't read the chinese, but the value of DirItems offen is empty, I can't find the reson.
I can't find the UnicodeName property, is it my compoent too old?
regards,
shareach
Re: I could not use it in window service by c#
Shareach,
What version of the component do you use?
If ListItems event fired, does FileInfo parameter return the result?
Regards,
Damba
Re: I could not use it in window service by c#
Hi,
At first I used wodFtpDLX.net component but wodFtpDLX, now I have changed to the Com component --- wodFtpDLX; It has not the chinese problem; thanks.
but I found a problem of ftp.RemotePath property, the following is my code, if have no the following code the ftp.RemotePath property value maybe /s/../s/a/.. , so has any other way I can get the real path like /s but /s/../s/a/.. .
My code:
string sRemote = ;
List<string> folderList = new List<string>();
string[] folders = ftp.RemotePath.Split('/');
for (int i = folders.Length - 1; i >= 0; )
{
if (folders == )
{
}
else if (folders == .. )
{
i--;
}
else
{
folderList.Add(folders);
}
i--;
}
for (int j = folderList.Count - 1; j >= 0; j--)
{
sRemote = sRemote + / + folderList[j];
}
if (sRemote == )
{
ftp.RemotePath = / ;
}
else
{
ftp.RemotePath = sRemote;
}
thanks
Re: I could not use it in window service by c#
Shareach,
I'm not really sure what exactly you are trying to do. When you connect to server, the component will automatically fill RemotePath property to user's home directory.
That means that you can check where server placed you immediately after you are connected to server.
Just remember that you always need to provide full absolute paths to component. Not the relateive paths.
Maybe I misunderstood your question? If you can you please explain?
Regards,
Damba
Re: I could not use it in window service by c#
My step:
1.I login to the server;
2.I used the command ftpClient.ListDir( / ) ;
3.I used the command ftpClient.ListDir( /s ) enter a sub-folder in FTPServer named s ;
4.I used the command ftpClient.ListDir( /s/.. ) to back to the parent folder / , the RemotePath will become /s/.. but not the / ;
so every time I execute the code to change /s/.. to / , it is all.
I understand what you said, you let me use the ftpClient.ListDir( / ) instead of the ftpClient.ListDir( /s/.. ) to go to parent folder. thanks, I want to know have any way I can read the / but /s/.. when I used the command ftpClient.ListDir( /s/.. ) .
This Com component is good.
thanks,
shareach
Re: I could not use it in window service by c#
Shareach,
Unfortunately, you can't do a ListDir(/s/.. ). This would in that case present relative path.
Instead you should do ListDir(/) as you already do.
Regards,
Damba