Code to get * .aspx on the website

Is there a way to get all .aspx files on my website? Maybe iterating through the site file structure and adding to the array?

+3
source share
3 answers
Directory.GetFiles(HttpContext.Current.Server.MapPath(@"/"), "*.aspx", SearchOption.AllDirectories);
+6
source

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

+1
source

Remember that you can define the .aspx page without having the actual file in the web.config file.

+1
source

Source: https://habr.com/ru/post/1698150/


All Articles