Friday, 15 May 2015

c# - Why, in Mono, won't WebRequestMethods.Ftp use the path in my URI? -


Please note that the problem described below is with Mono on Fedora. I tested the same code from Visual Studio and it actually behaved as expected. Is this a bug in mono?

In a browser I can go to ftp://10.32.70.50/docs and after entering my username / password I can list the contents ~ user Name / docs

My FTP client software will be read either the root directory ( ftp://10.32.70.50// ) or the top-level directory for my login Relative path after ( ftp://10.32.70.50/docs ).

  list & lt; String & gt; Delist = New list & lt; String & gt; (); Uri Tastri = new Uri (@ "FTP: //10.32.70.50:21 / doc"); FtpWebRequest request = (FtpWebRequest) WebRequest.Create (test); Request.Method = WebRequestMethods.Ftp.List directory; request. Credential = new network credentials ("username", "password"); FtpWebResponse response = (FtpWebResponse) request.GetResponse (); Stream response stream = response. Gateresonsstream (); Streamer reader = new streamreader (responses); While (reader.Peek ()> = 0) {dirlist.Add ((reader.ReadLine ())); }   

How do I get my code to use the path I added to the URI?

Update:

Work around: add a slash to the end of the path And this will work.


It was submitted as a bug in mono in June 2011:

opened: 2011-06-07 14:35 UTC Last Modified: 2011-06-07 14:35:02 UTC

No comments:

Post a Comment