Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper format to read FTP directory
Message
From
10/05/2012 11:43:12
 
 
To
10/05/2012 11:21:14
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01543372
Message ID:
01543425
Views:
24
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform