Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2007, 01:23 AM
Authorized User
 
Join Date: Feb 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in Ftp downloading process

Hi,
I am working in an appication where i have to download and upload files from ftp server. File upload process is working fine. But when i am trying to fetch all the file names from a folder in ftp server, it shows me an error "The remote server returned an error: (503) Server Unavailable."
The code is as follow

    private string[] GetFiles(string WildCard)
    {
         string ReturnStr = "";
         FtpWebRequest request = WebRequest.Create("ftp://machine IP/FolderName/" + WildCard) as FtpWebRequest;
         request.Method = WebRequestMethods.Ftp.ListDirectory;
         request.Credentials = new NetworkCredential("", "");
         StringWriter sw = new StringWriter();
         WebResponse response = request.GetResponse();
         Stream responseStream = response.GetResponseStream();
         int ch;

         while ((ch = responseStream.ReadByte()) != -1)
         ReturnStr = ReturnStr + Convert.ToChar(ch);

         responseStream.Close();
         response.Close();
         string[] sep = {"\r\n"};
         string[] Files = ReturnStr.Split(sep, StringSplitOptions.RemoveEmptyEntries);
         return Files;
    }

Thanks in Advance.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dreamweaver FTP Error zombelord Dreamweaver (all versions) 4 April 9th, 2008 10:13 AM
FTP Error caveatashish VB How-To 1 December 5th, 2007 09:15 AM
FTP Error bamdad Pro VB 6 3 September 5th, 2006 09:54 AM
Downloading files from an FTP server craigdberman Pro Visual Basic 2005 0 March 7th, 2006 12:13 PM
Downloading ZIP File from FTP Site [email protected] VS.NET 2002/2003 2 July 20th, 2003 05:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.