在网站中获取 *.aspx 的代码

发布于 2024-07-06 07:59:05 字数 52 浏览 7 评论 0原文

有没有办法获取我网站中的所有 .aspx 文件? 也许迭代站点的文件结构并添加到数组中?

Is there a method to get all of the .aspx files in my website? Maybe iterate through the site's file structure and add to an array?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

噩梦成真你也成魔 2024-07-13 07:59:05
Directory.GetFiles(HttpContext.Current.Server.MapPath(@"/"), "*.aspx", SearchOption.AllDirectories);
Directory.GetFiles(HttpContext.Current.Server.MapPath(@"/"), "*.aspx", SearchOption.AllDirectories);
仅此而已 2024-07-13 07:59:05

使用Directory.GetFiles("*.aspx"),可以获取目录中的所有文件。 您可以使其递归以获取任何子目录及其文件。

using Directory.GetFiles("*.aspx"), you can get all the files in the directory. And you can make it recursive to grab any sub directories and their files.

你在看孤独的风景 2024-07-13 07:59:05

请记住,您可以定义 .aspx 页面,而无需 web.config 中存在实际文件。

Keep in mind that you can define an .aspx page without having an actual file be there in the web.config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文