How I can get web page's content and save it into the string variable

前端 未结 4 1544
走了就别回头了
走了就别回头了 2020-11-28 03:59

How I can get the content of the web page using ASP.NET? I need to write a program to get the HTML of a webpage and store it into a string variable.

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 04:07

    Webclient client = new Webclient();
    string content = client.DownloadString(url);
    

    Pass the URL of page who you want to get. You can parse the result using htmlagilitypack.

提交回复
热议问题