[Mono-bugs] [Bug 688007] New: WebClient.OpenRead() fails when trying to access an anonymous ftp site

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Apr 16 13:23:54 EDT 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=688007#c0


           Summary: WebClient.OpenRead() fails when trying to access an
                    anonymous ftp site
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: test051102 at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101
Firefox/4.0

I have created a very simple example which works perfectly under .Net
Framework. In case of anonymous ftp sites, it is not necessary to set the
Credentials property of the WebClient object. But even when doing so, Mono
2.10.1 does not work as expected and it seems to be impossible to use
WebClient.OpenRead() for anonymous ftp site.

WebClient client=new WebClient();
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buf=new byte[1024];

//client.Credentials=new NetworkCredential("anon","anon at me.com");
Stream strm=client.OpenRead("ftp://ftp.myftpsite.com/");//enter an ftp
site+file to open!
strm.Read(buf,0,1024);
string strData = enc.GetString(buf);
strm.Close();


Reproducible: Always

Steps to Reproduce:
1.Run the example

Actual Results:  
(a)without setting the WebClient object's Credentials property:
System.Net.WebException in System.Net.FtpWebRequest.CheckIfAborted()

(b)explicitly setting the WebClient object's Credentials property for anonymous
access:
"System.ArgumentNullException: Argument cannot be null." in
System.Net.FtpWebRequest.set_Credentials()

Expected Results:  
No exception, simply download the corresponding remote file's content to
strData

-- 
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