Using Reflection in Asp.Net 2.0 Web Applications

I have been searching far and wide for this solution for a long time and I just sort of happened upon it…so I thought I would share it here.

One of the big changes from Asp.Net 1.1 to 2.0 was the format of their web projects. I actually really like the new format alot. There was, however, one problem that I could not get past. I have written various “plug-in” type frameworks where you specify classes in an xml file which are loaded at runtime. The xml usually looks something like this:

Item assembly=myAssembly class=myClass />

so at runtime I just have to load the given assembly and then I can create an instance of the given class. The problem with the new web project format is that you don’t really have control over your web project assembly name like you used to in Asp .net 1.1. So, here ist he trick I learned:

Assembly assembly = Assembly.Load(“App_Code”);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: