我想找出导致链接不起作用的原因。链接应该显示特定消息,而不是不起作用,例如 404 或 403。我如何才能发现导致给定请求失败的 HTTP 状态?
if (!IsLinkWorking(link))
{
//Here you can show the error. You don't specify how you want to show it.
TextBox2.ForeColor = System.Drawing.Color.Green;
TextBox2.Text += string.Format("{0}\nNot working\n\n ", link);
}
else
{
TextBox2.Text += string.Format("{0}\n working\n\n", link);
}