Skip to main content

[Migrated content. Thread originally posted on 28 January 2012]

Can anyone please give the syntax to download a file from a web server to the client PC.

I believe the code in C# would be:
WebClient Client = new WebClient ();
Client.DownloadFile("www.csharpfriends.com/.../index.aspx", " index.aspx");
or
WebClient Client = new WebClient ();
Stream strm = Client.OpenRead ("www.csharpfriends.com/.../index.aspx");

Thanks - I am new to Visual COBOL, and Object programming, so am struggling with "translating" C# to COBOL.

[Migrated content. Thread originally posted on 28 January 2012]

Can anyone please give the syntax to download a file from a web server to the client PC.

I believe the code in C# would be:
WebClient Client = new WebClient ();
Client.DownloadFile("www.csharpfriends.com/.../index.aspx", " index.aspx");
or
WebClient Client = new WebClient ();
Stream strm = Client.OpenRead ("www.csharpfriends.com/.../index.aspx");

Thanks - I am new to Visual COBOL, and Object programming, so am struggling with "translating" C# to COBOL.
Add the following Namespace:
$set ilusing"System.Net"

In COBOL this would look like:


            01 Client type WebClient.   
            procedure division using by value sender as object e as type System.EventArgs.
               set Client to new WebClient
               invoke Client::DownloadFile("www.csharpfriends.com/.../index.aspx", " index.aspx")



[Migrated content. Thread originally posted on 28 January 2012]

Can anyone please give the syntax to download a file from a web server to the client PC.

I believe the code in C# would be:
WebClient Client = new WebClient ();
Client.DownloadFile("www.csharpfriends.com/.../index.aspx", " index.aspx");
or
WebClient Client = new WebClient ();
Stream strm = Client.OpenRead ("www.csharpfriends.com/.../index.aspx");

Thanks - I am new to Visual COBOL, and Object programming, so am struggling with "translating" C# to COBOL.
Thank you so much, Chris. That works a treat. It's easy when you know how, but so hard if you don't.