如何让所有指定的Web地址的aspx页面列表 [英] How to get all the aspx page list of a given web address
本文介绍了如何让所有指定的Web地址的aspx页面列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建包含在我的网站上的所有ASPX页面的列表。
但我只得到40页。但也有2000多页。
请告诉我如何可以得到所有的aspx页面列表。
我使用下面的code得到URL的网页列表。
私人的String [] GetAllUrls(字符串str)
{
字符串模式= @< A * HREF =?['](小于?URL方式> *?),'] *>?(LT;名称> *?)LT; / A>中; System.Text.RegularEx pressions.MatchCollection匹配= System.Text.RegularEx pressions.Regex.Matches(STR,图案,System.Text.RegularEx pressions.RegexOptions.IgnoreCase);
字符串[] = matchList新的字符串[matches.Count]
INT C = 0; 的foreach(System.Text.RegularEx pressions.Match在比赛中赛)
matchList [C ++] = match.Groups [URL]值。返回matchList;
}
解决方案
我不知道你是如何得到这些40个文件,但你可以这样做:
的String [] =文件Directory.GetFiles(C:\\\\ YourSorce codeDirectory,*的.aspx,SearchOption.AllDirectories);
i want to create a list of all aspx pages contained in my website.
but i am getting only 40 pages. but there are more than 2000 pages.
Kindly tell me how can i get all the aspx page list. I am using the following code to get url pages list.
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;
}
解决方案
I don't know how you are getting these 40 files, but you can do this:
String[] Files = Directory.GetFiles("C:\\YourSorceCodeDirectory", "*.aspx", SearchOption.AllDirectories);
这篇关于如何让所有指定的Web地址的aspx页面列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文