views:

16

answers:

1

Trying to figure out how to programmatically access the web pages in the application. Just something simple like a list of them would be awesome. I know I can create a list but I was wondering if there was something that could 'look' at the pages and add a new one to the list if you make a new page for the application.

Example with 7 pages:

 Error
 Default
 Login
 Content
 Users
 ContactUs
 Admin

I am half awake so I may be a little unclear. Maybe puting it all in a single question will be easier.

How do you autogenerate a list of all webpages in your current application?

+3  A: 

In a traditional ASP.Net application, you can simply find all of the .aspx files, like this:

Directory.GetFiles(Server.MapPath("~/"), "*.aspx", SearchOption.AllDirectories)

Note that this will return full filepaths; you can call Path.GetFileNameWithoutExtension to get the names.

SLaks
Looks like this will work. Thanks!
Hazior