list files with auth ssl

Jul 2, 2012 at 2:19 PM

You need to use a client supporting PRET (PRE Transfer) to use PASV, seam to be the issiue in my little gui app.

 

 

private void button1_Click(object sender, EventArgs e)
        {

            using (FtpClient cl = new FtpClient("user", "pw", "myadress", 34147))
            {

                cl.FtpLogStream = Console.OpenStandardOutput();
                cl.FtpLogFlushOnWrite = true;

                cl.SslMode = FtpSslMode.Explicit;
             
                cl.SecurityNotAvailable += new SecurityNotAvailable(OnSecurityNotAvailable);
                cl.InvalidCertificate += new FtpInvalidCertificate(OnInvalidCertficate);

                listBox1.Items.Add(cl.CurrentDirectory);

                foreach (FtpListItem item in cl.GetListing(cl.CurrentDirectory.ToString()))
                {
                    listBox1.Items.Add(item);
                }
            }
        }

any ideas how to solve this? iv used sample code from the beta release.

Coordinator
Jul 2, 2012 at 2:35 PM
Before I get started, if you don't mind send me the FTP Transaction
log. The password should be omitted, feel free to take the username
out as well, all I'm really interested in is the response to the FEAT
command which tells me what features the ftp server advertises.
Ultimately I'm looking for a way to detect that PRET command even
needs to be used. With that said......

Never heard of PRET until today. Looks like it's part of DrFTPD, not
sure that it's used anywhere else. What you can do for now is this:

if(cl.Execute("PRET LIST {0}", cl.CurrentDirectory.FullName)) {
foreach(FtpListItem.....) ......
}

Similarly, this will need to be done for downloads and uploads. The
PRET command tells DrFTPD what command you're about to execute that
needs a passive channel so (that I guess?) it can prepare itself for
the passive transaction. I think this is some kind of extension they
are doing? Not sure that it's standard.

Examples:

if(cl.Execute("PRET RETR /path/to/remote/file")) {
cl.Download("/path/to/remote/file".....
}

if(cl.Execute("PRET STOR /path/to/remote/file")) {
cl.upload("foobar", "/path/to/remote/file".....
}



On Mon, Jul 2, 2012 at 8:19 AM, [email removed] wrote:
> From: Chris1244
>
> You need to use a client supporting PRET (PRE Transfer) to use PASV, seam to
> be the issiue in my little gui app.
>
>
>
>
>
> private void button1_Click(object sender, EventArgs e)
> {
>
> using (FtpClient cl = new FtpClient("user", "pw", "myadress",
> 34147))
> {
>
> cl.FtpLogStream = Console.OpenStandardOutput();
> cl.FtpLogFlushOnWrite = true;
>
> cl.SslMode = FtpSslMode.Explicit;
>
> cl.SecurityNotAvailable += new
> SecurityNotAvailable(OnSecurityNotAvailable);
> cl.InvalidCertificate += new
> FtpInvalidCertificate(OnInvalidCertficate);
>
> listBox1.Items.Add(cl.CurrentDirectory);
>
> foreach (FtpListItem item in
> cl.GetListing(cl.CurrentDirectory.ToString()))
> {
> listBox1.Items.Add(item);
> }
> }
> }
>
> any ideas how to solve this? iv used sample code from the beta release.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Jul 2, 2012 at 2:40 PM

where can i get that log?

my goal is to list all folders on ftp in a listbox, drftpd i use cos its a webserver :)

Coordinator
Jul 2, 2012 at 2:42 PM
cl.FtpLogStream = new FileStream(....);

should save the transaction to the specified file as text. If it was a
CLI app you could do this:

cl.FtpLogStream = Console.OpenStandardOutput();
cl.FtpLogStreamFlushOnWrite = true;

and it would log to the console window.

On Mon, Jul 2, 2012 at 8:40 AM, [email removed] wrote:
> From: Chris1244
>
> where can i get that log?
>
> my goal is to list all folders on ftp in a listbox, drftpd i use cos its a
> webserver :)
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Coordinator
Jul 2, 2012 at 3:15 PM

Alright, revision b1dbe8b1f905 should have support for the PRET command. Let me know if it works, I don't readily have a way to test it.

Jul 2, 2012 at 3:31 PM

i will test that now, is there a way to send raw commands to ftp server asl well?

site new etc

Coordinator
Jul 2, 2012 at 3:40 PM
Yeah, you can use the Execute() method of ftp client. The Extending
System.Net.FtpClient section under the documentation on this site
talks about it.

On Mon, Jul 2, 2012 at 9:31 AM, [email removed] wrote:
> From: Chris1244
>
> i will test that now, is there a way to send raw commands to ftp server asl
> well?
>
> site new etc
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Jul 2, 2012 at 3:45 PM

will try, the 3 files u added, where do i put them, sorry for asking stupid but never done it :)

Coordinator
Jul 2, 2012 at 4:07 PM
Easiest thing to do is just download the entire revision, should be a
download link on the source page. Drop the source files in a sub
folder of your project called System.Net.FtpClient and remove the
binary dll reference.

On Mon, Jul 2, 2012 at 9:45 AM, [email removed] wrote:
> From: Chris1244
>
> will try, the 3 files u added, where do i put them, sorry for asking stupid
> but never done it :)
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Jul 2, 2012 at 4:14 PM

i did that just now, missing referance , somthing else i did miss out?

 

System.Net.FtpClient  folder greated in debug folder.

Coordinator
Jul 2, 2012 at 4:17 PM
You need to include the files in your project. For example, Visual
Studio won't pick them up by default. In visual studio press Shift +
Alt + A and select all of the Ftp client files.

On Mon, Jul 2, 2012 at 10:14 AM, Chris1244 <notifications@codeplex.com> wrote:
> From: Chris1244
>
> i did that just now, missing referance , somthing else i did miss out?
>
>
>
> System.Net.FtpClient folder greated in debug folder.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Jul 2, 2012 at 4:27 PM
Edited Jul 2, 2012 at 4:27 PM

seam that the first error is gone, and removed the if statment u gave me.

testing to send SITE CMD variable1 with the :

 

cl.Execute("SITE CMD variable1 ");

 

doest not seam to send, site NEW works

Jul 4, 2012 at 11:16 AM

cl.Execute("SITE CMD variable1 ");

 

ideas why this aint working? :D

Coordinator
Jul 4, 2012 at 2:48 PM
I have no idea why it's not working. You haven't provided any information about what happens when you try to execute a raw command. The transaction log would go a long way, even the message from the exception that is thrown when the command fails would be helpful.

On Jul 4, 2012, at 5:16 AM, Chris1244 wrote:

> From: Chris1244
>
> cl.Execute("SITE CMD variable1 "); ideas why this aint working? :D
>
>