views:

81

answers:

3

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?

+1  A: 

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.

Darren Kopp
+5  A: 
Directory.GetFiles(HttpContext.Current.Server.MapPath(@"/"), "*.aspx", SearchOption.AllDirectories);
Shawn Miller
A: 

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

swilliams
thanks, I will keep that in mind.
Anders