简体   繁体   中英

How to access web page hierarchy inside a application

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM