Too much time to load a page using HttpWebResponse

I am trying to access information on a web page. The first time I did it. The problem is that it is too slow. By doing this on only one page, which loads very quickly in the browser, but forever here. The only thing I need here is the HTML behind the page, so I have to ask if my code is loading images somehow? Any help would be helpful in speeding up this process.

        string url;

        HttpWebRequest pedido = (HttpWebRequest)WebRequest.Create(url);

        HttpWebResponse resposta = (HttpWebResponse)pedido.GetResponse();
        //On the line above it takes forever to load.

        StreamReader SR = new StreamReader(resposta.GetResponseStream());


        string html;
        string tituloTemp = "";

        do
        {
            html = SR.ReadLine();
            if (html.Contains("<title>"))
                tituloTemp = html;

        } while (!(html.Contains("<title>")));
        SR.Close();
+3
source share
3 answers

I really found the answer here on stack overflow: Link here: HTTPWebResponse + StreamReader Very slow

0
source

Fiddler.

DNS, . Fiddler , . .

+1

, , ReadLine(), , . , , , . "" , .

, . #, :

# HTML-

html #?

0

Source: https://habr.com/ru/post/1735809/


All Articles