Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get the names of all the web forms created in a project in ASP.net.
Please Help. Thanks in Advance.
Posted
Updated 26-Aug-10 20:19pm
v2

By "Forms" do you mean "Web Form" (Aspx)?

If yes, then, do you want to get the "Web Form" names (Aspx page names) programmatically?

If yes, then, you should write a method that searches the Web root folder recursively and read all Web form (Aspx pages) names and returns.

However, if my assumptions are not correct, then please clarify your questions with further information.
 
Share this answer
 
You might be able to use reflection to do this. However, given that your forms don't exist until they are requested, the best way may be to search for .aspx files in all subfolders of your project.
 
Share this answer
 
Use Server.Mappath and name of your root folder to detect root folder of your application.
using System.IO namespace you will find different file and directory handler.
Recursively traverse through a loop and See if page.extension == ".aspx"
then Store that data into array,
and finally you will have all your pages.

Thanks.

Dont forget to mark as a answer
Hiren Solanki
 
Share this answer
 
Comments
Hiren solanki 27-Aug-10 9:35am    
hopefully nice answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900