469,941 Members | 2,516 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,941 developers. It's quick & easy.

Programatically find the pages in a project

Can anyone help out on this one?

i would like to find out all the ASPX and ASCX pages that are in my project,
and return them in an arraylist.

thanks,
Paul.
Nov 18 '05 #1
4 1192
You would have to load the assembly, and using reflection go through each
class to see if it inherits from Page or UserControl. If it does, add it to
your list of class names.

"Milsnips" <mi******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Can anyone help out on this one?

i would like to find out all the ASPX and ASCX pages that are in my project, and return them in an arraylist.

thanks,
Paul.

Nov 18 '05 #2
Well, you could recursively loop through the directory structure looking for
said files. something like:

Public Sub GetFiles(ByVal path As String, ByVal extension As String, ByVal
files As ArrayList)
For Each file As String In System.IO.Directory.GetFiles(path, extension)
files.Add(file)
Next
For Each directory As String In System.IO.Directory.GetDirectories(path)
GetFiles(directory, extension, files)
Next
End Sub

and you can use it via:

Dim files As New ArrayList
GetFiles(Server.MapPath("~"), "*.aspx", files)
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Milsnips" <mi******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Can anyone help out on this one?

i would like to find out all the ASPX and ASCX pages that are in my project, and return them in an arraylist.

thanks,
Paul.

Nov 18 '05 #3
thanks for the info,

how do i actually reference the assembly name/string in the assembly.Load
function? is it the DLL name?

regards,
Paul.

"Marina" <so*****@nospam.com> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
You would have to load the assembly, and using reflection go through each
class to see if it inherits from Page or UserControl. If it does, add it to your list of class names.

"Milsnips" <mi******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Can anyone help out on this one?

i would like to find out all the ASPX and ASCX pages that are in my

project,
and return them in an arraylist.

thanks,
Paul.


Nov 18 '05 #4
It depends on where that DLL is, etc. Look at the Assembly class's load
method that can load a specified assembly into memory.

"Milsnips" <mi******@hotmail.com> wrote in message
news:ek****************@TK2MSFTNGP12.phx.gbl...
thanks for the info,

how do i actually reference the assembly name/string in the assembly.Load
function? is it the DLL name?

regards,
Paul.

"Marina" <so*****@nospam.com> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
You would have to load the assembly, and using reflection go through each class to see if it inherits from Page or UserControl. If it does, add it

to
your list of class names.

"Milsnips" <mi******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Can anyone help out on this one?

i would like to find out all the ASPX and ASCX pages that are in my

project,
and return them in an arraylist.

thanks,
Paul.



Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Alex Nitulescu | last post: by
1 post views Thread by Nick via .NET 247 | last post: by
3 posts views Thread by Ben Crinion | last post: by
5 posts views Thread by Tim Mackey | last post: by
2 posts views Thread by Grey Alien | last post: by
2 posts views Thread by Phil Sandler | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.