Asp.net User Controls and reflection

I am trying to create a plug in type architecture in a asp.net webforms (C#) application.  The idea is to create usercontrols to represent difference views and then allow them to be discover-able via reflection.  I ahve done something similiar in window forms, but reflection does seem to be able to find the user controls.

I have tried implementing this 2 ways.  The first was to create a base abstract class that derived from System.Web.UI.UserControl and then derive my other user controls from that. (below)

public abstract class AccountControl: System.Web.UI.UserControl
{

    public abstract string displayName { get; }
    public abstract int displayOrder { get; }
    public abstract long accountID { get; set; }
}

Open in new window


But when i user reflection to try and find my child controls, the query i would normally use finds nothing?
var pages = System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
                        .Where(t => t.IsSubclassOf(typeof(AccountPage)) && !t.IsAbstract)
                        .Select(t => (AccountPage)Activator.CreateInstance(t));

Open in new window


I have also tried the approach of using a custom attribute on the user controls with the below reflection query, but it also returns nothing.
var Controls = System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
                            .Where(t => t.IsDefined(typeof(AccountAttribute), false))
                            .Select(t => (AccountControl)Activator.CreateInstance(t));

Open in new window


I am starting to think that user controls are not compiled in the same way as normal objects.  What am i missing here?  How can i implement this kind of thing in asp.net webforms?
MRSAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MRSAuthor Commented:
I figured it out.  For anyone else running into a similar problem, the issues was that my project was a "web site" and not a 'web application".  There is a difference in how they compile, more accurately when then compile that makes the difference.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul MacDonaldDirector, Information SystemsCommented:
Thank you for posting your solution!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.