.NET Framework Bookmark and Share   
 index > Network Class Library (System.Net) > Issue connecting to Stratus VOS system using FTPWebRequest
 

Issue connecting to Stratus VOS system using FTPWebRequest

I need to connect to a Stratus VOS system via a C# application (3.5 framework)and ftp files back and forth between the Stratus and a windows PC.

I am using the below commands to get started but the URI parsing process keeps choking. The problem is caused because it appears it expects a "/" after the IP address for fully qualified paths.The Status does not recognize "/" but instead wants ">" to change directories. Is there a way to override this behavior so it will accept ">" instead of "/" as well as not automatically stick the "/" if I don't include it?

FtpWebRequest
request = (FtpWebRequest)WebRequest.Create(ftp://xx.xxx.xxx.xx>dev1>testfile.out);

request.Method =

WebRequestMethods.Ftp.DownloadFile;

request.Credentials = new NetworkCredential("me","xxx");

FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Stream responseStream = response.GetResponseStream();

StreamReader reader = new StreamReader(responseStream);

lstActions.Items.Add(reader.ReadToEnd());

lstActions.Items.Add(

"Download Complete: " + response.StatusDescription);

reader.Close();

response.Close();


  • Moved byeryangMSFTMonday, September 07, 2009 5:31 AM (From:.NET Base Class Library)
  •  
Nizzle1
You'll need two slashes as far as I can see. The first is required as otherwise there's no possible way for the Uri class (?WebRequest) to even know where thehostname part ends! :-)

After that you should likelyleave in the '>' characters. You'll (likely) need the second slash so the FtpWebRequest know where the filename starts, e.g. with ftp://host1/path1>path2>path3/file.txt, it will connect to host1; CWD to "path1>path2>path3"; and RETR for "file.txt".

Hopefully it doesn't do anything too odd with the '>' chars... but it might...

Turn on network logging to see exactly what FtpWebRequest sends. See http://msdn2.microsoft.com/en-us/library/ty48b824.aspxand/or http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx
http://www.alanjmcf.me.uk/ Please follow-up in the newsgroup. If I help, mark the question answered
Alan J. McFarlane

You can use google to search for other answers

Custom Search

More Threads

• Downloading file but wrong data.
• SSL and Server Certificates
• Checking if remote ip address is connected to the server
• Smtp mail Displayname
• How can we split and download a file through http request
• getting access to wininet (httponly) cookies: to share with HttpWebRequest
• how can i convert string to ProtocolType?
• What is the visible IP Address seen by SMTP server?
• how to download Large file (min 200 MB) in asp.net
• Can't ping computer