.net – A reliable HTTP library for .Net 2.0


.Net's implementation of HTTP is … problematic. Beyond some issues in compliance with HTTP/1.0, what's bugging me right now is that HttpWebResponse.GetResponse() with ReadTimeout and Timeout set to 5000 blocks for about 20 seconds before failing (the problem is it should fail after 5 seconds, but it actually takes 20 seconds).

I need a library with better protocol conformance and timeout control. Know any?

Best Solution

According to Microsoft, what could be hanging is possibly the DNS resolution, which may take up to 15 seconds.

Solution - do the DNS resolving on your own (Dns.BeginGetHostByName).