Hector Minaya
Hector Minaya

Reputation: 1705

How do I obtain a list of all of the pages within an asp.net mvc project

How do I obtain a list of all of the pages within an asp.net mvc project for use in a dropdown list.

I'd also like to obtain a list of all of the controls within that page.

The problem is that I'd be calling this from a different project in the same solution.

Can i use reflection for this????

Upvotes: 1

Views: 229

Answers (1)

Achilles
Achilles

Reputation: 11299

You can use reflection to look at the classes in an assembly and see if they inherit from System.Web.UI.Page which would indicate if its a page. I'd look at the directory of the project(s) using a DirectoryInfo object and just filter the selection by the extension ".aspx"

Upvotes: 2

Related Questions