[Mono-bugs] [Bug 466530] New: FtpWebRequest logs into the wrong directory on Windows FTP servers

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 15 13:30:55 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=466530


           Summary: FtpWebRequest logs into the wrong directory on Windows
                    FTP servers
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: PC
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: programacion at cae.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
1.1.4322; .NET CLR 2.0.50727)

When accessing a ftp account on a Windows server, the FtpWebRequest always logs
into the user root directory, even if the connection string gives a directory
path.

On login, the Microsoft .NET implementation sends a PWD command to obtain the
starting directory (on Windows TP servers it might be different than /), and
then sends a CWD command appending the specified path in the connection string
to that.

The Mono implementation sends the PWD command, but doesn't send the CWD one.

This is a sample code where this behaviour can be cheched:

   FtpWebRequest ftp =
(FtpWebRequest)FtpWebRequest.Create("ftp://xxxx.xxx.com/subdir/");
   ftp.Credentials = new NetworkCredential("username", "xxxxx");
   ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
   FtpWebResponse response = (FtpWebResponse)ftp.GetResponse();
   StreamReader sr = new StreamReader(response.GetResponseStream(),
Encoding.Default);
   string result = sr.ReadToEnd();
   Console.WriteLine("Directory details: " + result);
   sr.Close();
   response.Close();

Reproducible: Always

Steps to Reproduce:
Try the included source code to connect to a windows ftp server directly into a
directory other than root.
Actual Results:  
The code returns the file list of the user root directory

Expected Results:  
The code should return the file list of the directory specified in the
connection string.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list