相关疑难解决方法(0)

HtmlAgilityPack获取Title和meta

我尝试练习"HtmlAgilityPack",但我遇到了一些问题.这是我编码的内容,但我无法正确获取网页的标题和描述...如果有人可以启发我的错误:)

...
public static void Main(string[] args)
    {
        string link = null;
        string str;
        string answer;

        int curloc; // holds current location in response 
        string url = "http://stackoverflow.com/";

        try
        {

            do
            {
                HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(url);
                HttpWReq.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5";
                HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
                //url = null; // disallow further use of this URI 
                Stream istrm = HttpWResp.GetResponseStream();
                // Wrap the input stream in a StreamReader. 
                StreamReader rdr = new StreamReader(istrm);

                // …
Run Code Online (Sandbox Code Playgroud)

c# title html-agility-pack

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

html-agility-pack ×1

title ×1