CSharp HttpClient by CodeScales.com
CodeScales C# HttpClient is An HTTP client library with a very simple API, written in CSharp (.Net 2.0) for sending HTTP requests and receiving HTTP responses.
You can use CodeScales HttpClient to send files and HTML-forms via HTTP, with very minimal coding, and it is much simpler to use than the HttpWebRequest provided with the .Net library.
This library was inspired by the JAVA HttpClient library, and has a very similar API.
How do I use it?
Just download the DLL from the download page.
If you are using .Net 4.0 or VS2008/VS2010, you also need to download this DLL.
What can you do with it?
- Send GET requests.
- Send POST requests with parameters, using Url-Encoded Entity.
- Upload Files to an HTTP server, using a Multipart Entity.
- Send Post request with parameters, using Multipart Entity.
- Control the redirect behavior of the client, using HttpBehavior.
- Use as many parallel connections (sockets) as you need, using the default HttpConnectionFactory.
- Use a proxy server that does not need a password
What HttpClient is NOT
HttpClient is NOT a browser. It is a client side HTTP transport library. HttpClient’s purpose is to transmit and receive HTTP messages. HttpClient will not attempt to cache content, execute javascript embedded in HTML pages, try to guess content type, or reformat request / redirect location URIs, or other functionality unrelated to the HTTP transport.
How much does HttpClient cost?
It Costs Zero$, nothing, ziltch, goornisht. CodeScales HttpClient is an open-source development project and is published under the Apache License 2.0. This means that it is absolutely free, and you can access the source code at the project’s Google Code site.
We would encourage you to give us some feedback via the comments in this site, or if you have found any BUGS you can report them directly at the Google Code site here.
Where can I download HttpClient from?
You can download if from CodeScales Google Code Download Page.
How can I contribute?
There are a number of ways you can help me with this project:
- Let your friends know about this project, send them a link or post the CodeScales.com link on your website.
- If you found the HttpClient library useful, let me know about it (via comments, or email me at yaron@codescales.com)
- If you are a C# developer, you can develop new features for the HttpClient library, or fix existing bugs. Please email me at yaron@codescales.com if you wish to do so.
- You can post feature requests, and bug reports in the Google Code site.
September 27th, 2010 on 5:31 pm
I am very interested in using HttpClient as part of my project.
I will actually be using the “mirror” Java classes “FileUpload” on my server side to receive a file being posted from these classes on my C# client.
I would love to see the opposite example; that is, checking and receiving/downloading a file from the HTTP server via a GET (and using the Content-disposition to create the file on the local client by name).
Thanks!
-AJ
March 17th, 2011 on 11:05 am
Hi, great code. I was trying very hard to send some information from .net to Apache server, using httpwebRequest. I also read multipart standard!!!. I try every possible configuration, i check, i change options, settings and so on. Find a lot of code in a lot of websites, but after reaching this site and code all goes fluently, just Execute and I send 2 parameters and i file. Great code, no errors. Great Job!!! Best regards from Madrid!!!!
August 30th, 2011 on 4:20 am
Hi, nice library but as far as I can see it does not support proxies that require authentication.
I see that you can pass a uri to a proxy but there is no way to pass through credentials(?); Correct me if I am wrong
Best wishes
Mark
August 31st, 2011 on 7:55 am
Hi Mark,
You are correct, I did not write any code for proxies that support authentication.
I welcome you to contribute to the code, and add this feature yourself: http://code.google.com/p/c-sharp-http-client/source/checkout
I will be happy to support you in the process.
Thanks
Yaron
September 21st, 2011 on 7:54 pm
Is basic authentication to the web server supported? (Not a proxy, but just web server authentication)
September 23rd, 2011 on 3:35 am
I now realize basic authentication does work. One needs to add the appropriate header like this:
postMethod.Headers.Add(“Authorization: Basic ” + Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(“username:password”)));