Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FTP Example Question
Message
From
03/05/2010 08:41:26
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01462731
Message ID:
01462764
Views:
45
This is as good a place as any to get off on a rant about one of my primary peeves about .NET training and examples - the console app! In real life there are no console apps !! <s>

Dropping out of the windows environment to run something that looks like it was created in edlin in DOS 2.0 is just silly.

Surely messageboxes, redirection to the output window, pretty much anything that didn't involve popping up a silly black screen would hew closer to the kind of app people are actually trying to write.

Were I writing training material the first thing on my agenda would be to write a simple harness app that would accept the output and display it in the Windows envrironment.

/set rant off

>>I'm lookoing at this example on MSDN on how to FTP download a file. I don't see where the file is downloaded to...
>>
>>This is the page and the code
>>http://msdn.microsoft.com/en-us/library/ms229711(VS.90).aspx
>>
>>using System;
>>using System.IO;
>>using System.Net;
>>using System.Text;
>>
>>namespace Examples.System.Net
>>{
>>    public class WebRequestGetExample
>>    {
>>        public static void Main ()
>>        {
>>            // Get the object used to communicate with the server.
>>            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
>>            request.Method = WebRequestMethods.Ftp.DownloadFile;
>>
>>            // This example assumes the FTP site uses anonymous logon.
>>            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");
>>
>>            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
>>    
>>            Stream responseStream = response.GetResponseStream();
>>            StreamReader reader = new StreamReader(responseStream);
>>            Console.WriteLine(reader.ReadToEnd());
>>
>>            Console.WriteLine("Download Complete, status {0}", response.StatusDescription);
>>    
>>            reader.Close();
>>            response.Close();  
>>        }
>>    }
>>}
>
>To the console :-}


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform