Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpClient for C# application

just starting to create an API to my a web application using the ASP.NET MVC4 Web API project template. http://www.asp.net/mvc/mvc4

No problems with the API so far, but I was about to write a small C# app to test the API.

Almost all the sample I can find is using the a class called HttpClient.

Where can I find the HttpClient and how do I install it?

like image 856
Markus Avatar asked Nov 29 '22 15:11

Markus


2 Answers

Rather than using the build in HttpClient class of the .NET framework which has a lot of issues when dealing with StatusCodes that are different than the expected ones. I recommend using a library called RestSharp.

It has become .NET Http/Rest client of choice, you can get it here: http://restsharp.org/

It is a very powerful library that is perfectly suited to do what you want.

like image 189
ntziolis Avatar answered Dec 02 '22 03:12

ntziolis


It's on nuget, search for HttpClient

http://nuget.org/packages/System.Net.Http

like image 38
Antony Scott Avatar answered Dec 02 '22 03:12

Antony Scott