Need Httpclient example


Active member
Aug 23, 2012
Programming Experience
I'm new to C# programming and am looking for a simple way to use Httpclient to fetch a text file from my website.

I've found some examples but they produce errors because I don't know how to declare them in the Usings section. Experienced C# coders know how to do this but new coders don't, thus I can't run the examples. Then I see many different ways to use Httpclient.

Can someone show me a simple way to use Httpclient and what using declarations I need?

I found this code which looks pretty simple:

var client = new HttpClient(); var response = client.Get("");

I want to display the response in a label on my form so I'm going to use this code:

lbl_Results.Text = response;

Will that work on the response object? I tried some example code before and this line wouldn't work because response wasn't a string.

Thanks for any help...
Top Bottom