Code stop if 404 not found
Hi I use the code below to check 5 url but if the ex: url no 3 is 404 not
found the code will stop from checking the 4th url, anyway I can do to
make the code run untill the url lists finished?
private void button2_Click(object sender, EventArgs e)
{
try
{
for (i = 0; i < listBox1.Items.Count; i++)
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(listBox1.Items[i].ToString());
if (response.StatusCode == HttpStatusCode.OK)
{
listBox3.Items.Add(listBox1.Items[i].ToString());
}
}
}
catch (WebException x)
{
}
}
No comments:
Post a Comment