views:

61

answers:

3

What features do you want to see in System.Net.HttpWebRequest and System.Net.WebClient that are not included out of the box?

What cannot or cannot be easily achieved with those classes?

I'd like to be able to:

  • Use bandwidth throttling when downloading (useful for large files).
  • Upload multiple files and key-value pairs via HTTP post (A single file and a single collection of key-value pairs is easy using WebClient).
+3  A: 

I would like to see both of these classes updated to allow asynchronous operation via Task and Task<T>.

Some examples -

In WebClient, I would like to see methods like -

Task<string> WebClient.DownloadStringTask(Uri uri);

In HttpWebRequest, I'd like to see:

Task<Stream> HttpWebRequest.GetRequestStreamTask();

Granted, the second is usable using TaskFactory.FromAsync, but that's not as simple as it could be.

Reed Copsey
Interesting - why the multiple downvotes on what I see as missing features?
Reed Copsey
A: 

I wish that .NET had a HTTP connector that used the WinINet subsystem. (Or faked it really, really well.)

In a number of cases I "fall back" to MSXML/XMLHTTPRequest simply because the connections "work like IE" -- if the user can access it in IE, then they can access it via MSXML. The following is not always true about the .NET connector without a manual configuration. Uhg.

My experience comes from .NET35 and I am not sure what .NET4 changes.

Edit: If you do down vote (which is perfectly okay), please leave a comment as to why. Thanks.

pst
A: 

Download html page + css + images to a single MHT file.

I'd like to be able to download the web page with all CSS, images and scripts and save it to a single MHT file. Then I would use it as HTML body of MailMessage.

Martin Vobr