Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.9k views
in .NET FTP by (240 points)
Hi,

I have the free version of this .NET FTP client (1.1.9). I need the ability to set permissions on newly created directories. The version I have doesn't seem to support this. Is this supported in more recent FREE versions of this widget ?

Thanx,

Barry

5 Answers

0 votes
by (51.6k points)
No, the problem is that the FTP protocol does not specify a way of changing file permissions. Some servers support it using SITE commands such as
site chmod 755 myfile.txt


You can execute this command through the edtFTPnet API using:
ftpConnection.InvokeSiteCommand("CHMOD", "755", "myfile.txt")


Obviously the value of the last 2 arguments vary.

Of course your server may not support that command. Or it may be that it has defined some other command for it.

- Hans (EDT)
0 votes
by (240 points)
Thanx for the info, but it doesn't quite explain how to do it from .NET (with or without your FTP widget).

FTPClient ftpClient = new FTPClient(ConfigurationSettings.AppSettings["ftpServer"]);
.
.
.
ftpClient.MkDir(ConfigurationSettings.AppSettings["ftpServerDir"] + id.ToString() + "//");

...and the next command to change permission on the new directory would be ?
0 votes
by (51.6k points)
OK, since you're using FTPClient (old) instead of FTPConnection (new), you'll need to use the FTPClient.Site(string) method.

- Hans (EDT)
0 votes
by (240 points)
Ok..thanx for th einfo...and if I went to the newest version of the widget, the command would be:

ftpConnection.InvokeSiteCommand("CHMOD", "755", "myfile.txt")

Correct ?
0 votes
by (162k points)
Yes - with a big caveat that many FTP servers will not allow/support the use of chmod.

Categories

...