List of Pages

Discussion in 'ASP .Net' started by JezB, Jun 17, 2004.

  1. JezB

    JezB Guest

    Can I programatically get a list of Pages that are part of an ASP.NET
    assembly ?
     
    JezB, Jun 17, 2004
    #1
    1. Advertising

  2. "JezB" <> wrote in message
    news:%...
    > Can I programatically get a list of Pages that are part of an ASP.NET
    > assembly ?


    You could use Reflection to iterate through all the classes in the assembly
    and then look at those which derive from System.Web.UI.Page.
    --
    John Saunders
    johnwsaundersiii at hotmail
     
    John Saunders, Jun 17, 2004
    #2
    1. Advertising

  3. JezB

    JezB Guest

    I could indeed, good idea. I'll give it a try.

    "John Saunders" <> wrote in message
    news:...
    > "JezB" <> wrote in message
    > news:%...
    > > Can I programatically get a list of Pages that are part of an ASP.NET
    > > assembly ?

    >
    > You could use Reflection to iterate through all the classes in the

    assembly
    > and then look at those which derive from System.Web.UI.Page.
    > --
    > John Saunders
    > johnwsaundersiii at hotmail
    >
    >
     
    JezB, Jun 18, 2004
    #3
  4. JezB

    JezB Guest

    For the record:

    private ArrayList GetPages(Assembly a)
    {
    ArrayList pages = new ArrayList();
    foreach (Type tt in a.GetTypes())
    {
    if (tt.BaseType.Name == "Page")
    pages.Add(tt.Name);
    }
    return pages;
    }

    "JezB" <> wrote in message
    news:...
    > I could indeed, good idea. I'll give it a try.
    >
    > "John Saunders" <> wrote in message
    > news:...
    > > "JezB" <> wrote in message
    > > news:%...
    > > > Can I programatically get a list of Pages that are part of an ASP.NET
    > > > assembly ?

    > >
    > > You could use Reflection to iterate through all the classes in the

    > assembly
    > > and then look at those which derive from System.Web.UI.Page.
    > > --
    > > John Saunders
    > > johnwsaundersiii at hotmail
    > >
    > >

    >
    >
     
    JezB, Jun 18, 2004
    #4
  5. "JezB" <> wrote in message
    news:...
    > For the record:
    >
    > private ArrayList GetPages(Assembly a)
    > {
    > ArrayList pages = new ArrayList();
    > foreach (Type tt in a.GetTypes())
    > {
    > if (tt.BaseType.Name == "Page")
    > pages.Add(tt.Name);
    > }
    > return pages;
    > }


    I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work better.
    Yours will pick up my own type called "Page".
    --
    John Saunders
    johnwsaundersiii at hotmail


    > "JezB" <> wrote in message
    > news:...
    > > I could indeed, good idea. I'll give it a try.
    > >
    > > "John Saunders" <> wrote in message
    > > news:...
    > > > "JezB" <> wrote in message
    > > > news:%...
    > > > > Can I programatically get a list of Pages that are part of an

    ASP.NET
    > > > > assembly ?
    > > >
    > > > You could use Reflection to iterate through all the classes in the

    > > assembly
    > > > and then look at those which derive from System.Web.UI.Page.
    > > > --
    > > > John Saunders
    > > > johnwsaundersiii at hotmail
    > > >
    > > >

    > >
    > >

    >
    >
     
    John Saunders, Jun 18, 2004
    #5
  6. JezB

    JezB Guest

    Yes, that's cleaner - thank you.
    (IsSubclassOf)

    "John Saunders" <> wrote in message
    news:uk$%...
    > "JezB" <> wrote in message
    > news:...
    > > For the record:
    > >
    > > private ArrayList GetPages(Assembly a)
    > > {
    > > ArrayList pages = new ArrayList();
    > > foreach (Type tt in a.GetTypes())
    > > {
    > > if (tt.BaseType.Name == "Page")
    > > pages.Add(tt.Name);
    > > }
    > > return pages;
    > > }

    >
    > I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work

    better.
    > Yours will pick up my own type called "Page".
    > --
    > John Saunders
    > johnwsaundersiii at hotmail
    >
    >
    > > "JezB" <> wrote in message
    > > news:...
    > > > I could indeed, good idea. I'll give it a try.
    > > >
    > > > "John Saunders" <> wrote in message
    > > > news:...
    > > > > "JezB" <> wrote in message
    > > > > news:%...
    > > > > > Can I programatically get a list of Pages that are part of an

    > ASP.NET
    > > > > > assembly ?
    > > > >
    > > > > You could use Reflection to iterate through all the classes in the
    > > > assembly
    > > > > and then look at those which derive from System.Web.UI.Page.
    > > > > --
    > > > > John Saunders
    > > > > johnwsaundersiii at hotmail
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    JezB, Jun 18, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Manish
    Replies:
    1
    Views:
    668
    Steve C. Orr [MVP, MCSD]
    Nov 17, 2003
  2. Mike Kingscott
    Replies:
    0
    Views:
    571
    Mike Kingscott
    Dec 5, 2003
  3. Ryan Taylor
    Replies:
    3
    Views:
    897
    Hermit Dave
    Sep 29, 2004
  4. Carl Gilbert
    Replies:
    1
    Views:
    679
    Carl Gilbert
    Jul 8, 2005
  5. moondaddy

    Convert htm pages to aspx pages

    moondaddy, Dec 15, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,103
    moondaddy
    Dec 15, 2005
Loading...

Share This Page