我想創建一個包含在我的網站中的所有aspx頁面的列表。如何獲取給定網址的所有aspx頁面列表
但我只有40頁。但有超過2000頁。
請告訴我如何獲得所有aspx頁面列表。 我正在使用下面的代碼來獲取url頁面列表。
private string[] GetAllUrls(string str)
{
string pattern = @"<a.*?href=[""'](?<url>.*?)[""'].*?>(?<name>.*?)</a>";
System.Text.RegularExpressions.MatchCollection matches = System.Text.RegularExpressions.Regex.Matches(str, pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
string[] matchList = new string[matches.Count];
int c = 0;
foreach (System.Text.RegularExpressions.Match match in matches)
matchList[c++] = match.Groups["url"].Value; return matchList;
}
你怎麼知道有2,000頁? –
你最近怎麼樣收到這40頁?顯示你的嘗試。 –
粘貼代碼請知道你是怎麼做到的 –