FtpWebRequest Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Phillips

    FtpWebRequest Problem

    Hello All:
    I've seen some strange behavior with the .net FtpWebRequest component.


    static void Main(string[] args)
    {
    Console.WriteLi ne("Connecting to server to list
    directory...");
    Uri uri = new Uri("ftp://192.168.0.3/data/");
    FtpWebRequest listRequest =
    (FtpWebRequest) WebRequest.Crea te(uri);
    listRequest.Cre dentials = new NetworkCredenti al("user",
    "pwd");
    listRequest.Met hod = WebRequestMetho ds.Ftp.ListDire ctory;
    listRequest.Kee pAlive = true;
    listRequest.Use Binary = true;
    listRequest.Use Passive = true;
    FtpWebResponse listResponse =
    (FtpWebResponse )listRequest.Ge tResponse();
    //Console.WriteLi ne(listResponse .BannerMessage. ToString());

    StreamReader reader = new
    StreamReader(li stResponse.GetR esponseStream() );
    string st = reader.ReadToEn d();
    Console.WriteLi ne("List Response:");
    Console.WriteLi ne(st);
    Console.ReadLin e();
    }

    This code will produce a WebException 550 File unavailable. The
    Response object StatusDescripti on contains the value "550 Arguements
    too long". The folder contains about 800 files. If I change the Uri
    to:
    Uri uri = new Uri("ftp://192.168.0.3/data/000*.dat");
    the program works - it brings back a directory listing matching the
    uri. Does anyone know if there is a problem or limitation with the
    ..Net FTP components?
    -Bob

Working...