Skip to content Skip to sidebar Skip to footer

Httpwebresonse Hangs On Multiple Request

I've an application that create many web request to donwload the news pages of a web site (i've tested for many web sites) after a while I find out that the application slows down

Solution 1:

Fetch function is called recursively and always creates HttpWebRequest but releasing only when url is matched. You have to close request and response in else statement.

Solution 2:

I agree with @volody, Also HttpWebRequest already have property called MaximumAutomaticRedirections, which is set to 50, you can set it to 5 to automatically achieve what you are looking for in this code anyway, it will raise exception and that will be handled by your code.

Just set

request.MaximumAutomaticRedirections  = 5;

Post a Comment for "Httpwebresonse Hangs On Multiple Request"