Using Wget to programatically download files in c#

I've never used Wget before and have been told do so if I want to download some files.  
How would I run the requests like the ones below in a C# program on a windows machine?
Where do I choose the directory to which the files (text not JSON) should be saved.

HTTP request must include Authorization header whose value equals Base64 encoded value of “username:password”, which is “U2345API:123456”.
> wget --user="U2354API " --password="123456" "https://host/files" --auth-no-challenge -qSO –
HTTP Request
GET /files HTTP/1.1
Host: host
Authorization: Basic qqq
Cache-Control: no-cache


>wget --user="U22623API" --password="qweqwe"
"https://host/files/download?type=204" --auth-no-challenge --content-disposition –qS
HTTP Request
GET /files/download?type=204 HTTP/1.1
Host: host
Authorization: Basic qqq
Cache-Control: no-cache
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
It could be something like this:
string username = "U2345API";
string password = "123456";
string url = "https://host/files/download?type=204";

string page;
using(var client = new WebClient()) {
    client.Credentials = new NetworkCredential(username, password);
    page = client.DownloadString(url);

Open in new window

Then either use page as is or write it to a file.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlHal2Author Commented:
Gustav BrockCIOCommented:
You are welcome!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.