Timeout supported Multithreaded Web Request

If you are using it for simple purposes, WebClient is enough. Absence of Timeout you can inherit it and override it's GetWebRequest method easily:

protected override WebRequest GetWebRequest(Uri address)
{
    WebRequest request = base.GetWebRequest(address);
    request.Timeout = Timeout;
    return request;
}

If you are using it multithreaded way, you have to set MaxConnection by code or app.config: Improving performance of multithreaded HttpWebRequests in .NET

You can parallelize it easily also: Best practics for parallelize web crawler in .net 4.0

Maybe Microsoft created new HttpClient class for implemantation problems of WebClient (HttpWebRequest)

But it does not have Proxy,Gzip support.

For WebClient:

Setting up Timeout still useless in multithreaded implemantation!

Concurrency Limit on HttpWebRequest

So the question:

I need FastWebClient with proxy,timeout(working one),gzip support. I will use it with multiple proxies, so I definetely need multiple FastWebClient.

Or Helper:

FastWebHelper.DownloadString (string url,WebProxy proxy,int timeout)

Any idea ?

Answers


Sure. WebClient.DownloadStringAsync Method You would still need to create 1 WebClient instance per connection/request, as it's not stateless.


Need Your Help

Ninject in MVC 5 Controller

c# asp.net-mvc ninject

If I want to use Ninject to create a service in my HomeController, I can do:

JQuery direct child x or y

jquery

How can I write a selector to have a direct child x or y, for example I have this selector at this moment

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.