is there a popular C# library for working HTTP? Eg simplifing working with httpwebrequest etc
For example doing http file upload with some parameters requires many lines and knowledge of Http protocol content format etc. WebClient itself do not do it.
So being new, is there a well know library that c# developers use here?
Thanks
WebClient will do it. Like:
If this is not enough, be more specific. What 'parameters' do you mean?
Chilkat Components
http://www.example-code.com
this is best answer I could determine so far:
Here's a link I found that gets close to what I was thinking of. This solves my specific requirement, however doesn't seem to be overly broad in terms of methods. Perhaps these are just the key helper methods that are required mostly above/beyond basic WebClient / HttpWebRequest classes suport? Anyway if anyone knows of a popular c# HTTP library is better known than this let me know please. Else for the moment this link is the best I can find so far that answers my questions. Thanks for all the comments to-date.
Do check out HTML Agility Pack on CodePlex :
There's also thread here on SO that may be of interest to you.
Web forms are submitted in one of two formats: application/x-www-form-urlencoded and multipart/form-data.
WebClient provides a very simple and convenient way to upload any kind of data to a website. In case of application/x-www-form-urlencoded all you have to do is to provide a NameValueCollection. In case of multipart/form-data, AFAIK, you have to create the request data yourself (which may include both files and name value pairs).
application/x-www-form-urlencoded
WebClient.UploadValues sets the HTTP method to
"POST"
and the Content-Type to"application/x-www-form-urlencoded"
, URL-encodesformData
and uploads it to the specifieduriString
.multipart/form-data
This sets the Content-Type to
"multipart/form-data"
with the boundary used in the request data. WebClient.UploadData sets the HTTP method to"POST"
and uploads the byte array to theuriString
. The request data in this example contains a filefile1.dat
and a form parametersubmit-name
which is set toLarry
. The format is described in RFC2388.Are you looking for an Ajax library, a file upload control, or both, or neither? Check out the AjaxToolkit's AsyncFileUpload.