Am i able to use a HttpWebRequest?
It seems like the 3rd request to a site causes a operation timed out and it seems like each creates a new connection so i want to know if i can reuse a HttpWebRequest by changing the url and getting the request again. Code in question is below and this code is to check if a range of urls exist.
static void storeList(TextWriter sw, string urlTemplate, int start, int end)
{
for (int i = start; i < end; i++)
{
var url = string.Format(urlTemplate, i);
var req = (HttpWebRequest)HttpWebRequest.Create(url);
{
req.Method = "HEAD";
tryHttpWebRequest
{
var resp = req.GetResponse();
sw.WriteLine(i);
}
catch (Exception e)
{
}
}
}
sw.Flush();
}