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

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 28 02:31:30 EDT 2011


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

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


--- Comment #7 from QuickJack . <test051102 at hotmail.com> 2011-04-28 06:31:28 UTC ---
I am using different testing machines. This one runs Ubuntu Maverick and does
have a direct internet connection and is not using a proxy. I have compiled
current Mono master yesterday evening. Anonymous ftp is working now! However,
accessing a password protected ftp site is not fully working. I created a
console application using the following code:

using System;
using System.Net;
using System.IO;

namespace WebClient.Test
{
    class MainClass
    {
        public static void Main (string[] args)
        {           
            System.Net.WebClient client=new System.Net.WebClient();
            //client.Credentials=new
NetworkCredential("user","test");//explicitly setting credentials works
            System.IO.Stream
strm=client.OpenRead("ftp://user:test@192.168.1.10/test/divx.txt");//specifying
credentials via url fails!!!
            System.Text.ASCIIEncoding enc=new System.Text.ASCIIEncoding();
            byte[] buf=new byte[256];

            strm.Read(buf,0,256);
            string strContent=enc.GetString(buf);
            strm.Close();
            Console.WriteLine ("Hello World!");
        }
    }
}

I used the Quick'n'Easy Ftp Server (Freeware) under WinXP to set up a password
protected site on another machine.

Specifiying credentials via the url is not working. The relevant code is in
FtpWebRequest.Authenticate() which tries to access the site using anonymous
credentials in this case. It simply ignores the credentials which are supplied
via the url. This should be fixed.

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


More information about the mono-bugs mailing list