HttpWebRequest issues

Posted by Allen Ho on Stack Overflow See other posts from Stack Overflow or by Allen Ho
Published on 2010-04-08T22:27:05Z Indexed on 2010/04/08 22:33 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

Hi,

Im still having issues using HttpWebRequest.

For some reason sometimes in my app the call just times out...

HttpWebRequest req = null;
req =
   (HttpWebRequest)WebRequest.CreateDefault(new Uri(aRequest));
req.PreAuthenticate = true;
req.AllowAutoRedirect = true;
req.KeepAlive = false;

.....

resp = (HttpWebResponse)req.GetResponse();
resp.close();

I am closing the response but Im just wondering if it is more likely to fail since Im making requests all over the place?

I tried playing around with the ServicePointManager class hoping it would help but it hasnt really

System.Net.ServicePointManager.DefaultConnectionLimit = 100;
System.Net.ServicePointManager.MaxServicePoints = 100;

© Stack Overflow or respective owner

Related posts about c#

Related posts about httpwebrequest