|
Thread: Ftp
-
Dec 4th, 2005, 03:00 PM
#1
Thread Starter
PowerPoster
Ftp
Hi there.
using .NET 2.0 here and C# 
I am trying to use the FTP stuff in the Framework but have a couple of Questions....
Fair enough, when we request the directory (ListDirectory) we see all the files and folders. Cool! But, if we wish to navigate to a selected folder, how do we do this?
Currently I am thinking that we need to pretty much re-establish a connection BUT add the name of the directory infront of the FTP URL, surely there must be another way because I can think of a few disadvantages of doing it this way...
As well as this, is there a way to see what type the folder/file it is? (if the current selected "text" is a file/folder?)
I would be appreciated if someone can give me an answer to my first question if possible, the 2nd one is not as important.
Thank-you
-
Dec 4th, 2005, 07:56 PM
#2
Lively Member
Re: Ftp
http://cr.yp.to/ftp.html
yere ya go. read up a bit on the protocol.
Last edited by deranged; Dec 4th, 2005 at 08:00 PM.
-
Dec 4th, 2005, 08:04 PM
#3
Thread Starter
PowerPoster
Re: Ftp
lol im sorry but thats not helpful. I KNOW about the FTP protocol but wanting to know how to actually do this in .NET
currently im just making a new FtpWebRequest object everytime I wish to perform a command. So pretty much if i wish to navigate to a selected folder, I've done this....
BUT how can I see if the selected item is a folder/file? I always get an exception stating that the remote server returned an error (550) - File unavailable. But the file DOES exist as if i change the method to "ListDirectory"... it works fine but of course not doing what I want to do... get the file size or just to check to see what type of item it is that has been selected
im doing this:
Code:
FtpWebRequest temp = (FtpWebRequest)WebRequest.Create(this.listRequest.RequestUri + "/" + selectedItem);
temp.Method = WebRequestMethods.Ftp.GetFileSize;
temp.Credentials = new NetworkCredential(this.txtUsername.Text, this.txtPassword.Text);
FtpWebResponse theFTPObjectResponse = (FtpWebResponse)temp.GetResponse(); //HERE
this.reader = new StreamReader(temp.GetResponse().GetResponseStream());
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|