Is there a faster way to check if an external web page exists?

前端 未结 5 867
感情败类
感情败类 2021-02-07 12:23

I wrote this method to check if a page exists or not:

protected bool PageExists(string url)
{
try
    {
        Uri u = new Uri(url);
        WebRequest w = WebR         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 12:51

    One obvious speedup is to run several requests in parallel - most of the time will be spent on IO, so spawning 10 threads to each check a page will complete the whole iteration around 10 times faster.

提交回复
热议问题