Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper format to read FTP directory
Message
De
10/05/2012 11:43:12
 
 
À
10/05/2012 11:21:14
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01543372
Message ID:
01543425
Vues:
25
>>What output do you get with this example http://msdn.microsoft.com/en-us/library/ms229716.aspx
>>
>>I get something like this
>>
>>
>>12-30-10  03:50PM                37343 File1.htm
>>12-30-10  03:01PM               355391 File1.pdf
>>12-30-10  02:54PM       <DIR>          File1_files
>>
>
>How do you connect to that site? The host www.contoso.com is not responding. I tried in IP as well.


That's an example, you have to use valid data
	class FtpTest
	{
		// put valid data here
		static string Url = @"ftp://111.222.333.4"; 
		static string Folder = "subdirectory";
		static string UserId = @"userid";
		static string Password = @"password";


		static void Main(string[] args)
		{
			FtpWebRequest request = (FtpWebRequest)WebRequest.Create(Url + '/' + Folder);
			request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;

			request.Credentials = new NetworkCredential(UserId, Password);

			FtpWebResponse response = (FtpWebResponse)request.GetResponse();
			Stream responseStream = response.GetResponseStream();
			StreamReader reader = new StreamReader(responseStream);
			Console.WriteLine(reader.ReadToEnd());

			Console.WriteLine("Directory List Complete, status {0}", response.StatusDescription);
			reader.Close();
			response.Close();


			Console.ReadLine();




		}

	}
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform