2011-05-05 97 views
1

我writen使用此代碼 IM因爲如果certin網址是一個網頁我如何獲得freindly網址?

private void checkUrls(){ 

     WebClient client; 

     for (int i = 0; i < Convert.ToInt32(txtnum.Text); i++) { 
      try 
      { 
       string Url = "http://www." + txtUrl.Text + i.ToString(); 

       client = new WebClient(); 
       string result = client.DownloadString(Url); 
       if (result.Contains(txtsearch.Text)) 
        MessageBox.Show(Url); 

      } 
      catch (Exception ex) { } 

基本URL看起來像這樣在發現檢查:
http://www.example.com/?p=35

但兩個網站,當我問爲此:
http://www.example.com/?p=35

我重定向到財產以後這樣
http://www.example.com/some_categoery/postitle/

我需要搜索網站的第一方式 但下載URL間友好的

誰能告訴我正確的方向做這樣的內容?

我檢查網站,我做不知道有多少頁的網站時

回答

2

上你可以嘗試HtmlAgilityPack讓所有的錨標籤,並選中你想要的值href屬性。

相關問題