J
johnrlewis
I need to dynamically create an instance of a class that is in the
/App_Code directory. I do not know the name of the class at
design-time. It is provided to me in the form of a string.
If I use Type.GetType("MyClassName"), I get a null reference because I
did not specify an assembly name. I cannot specify an assembly name
because it is dynamically generated at run-time.
This used to be easy in ASP.NET 1.x because everything was compiled
into a single assembly with a known name. In ASP.NET 2.0 each source
file ends up as a seperate assembly with a random name.
I have seen this question asked many times, but have not seen it
answered. Please help.
/App_Code directory. I do not know the name of the class at
design-time. It is provided to me in the form of a string.
If I use Type.GetType("MyClassName"), I get a null reference because I
did not specify an assembly name. I cannot specify an assembly name
because it is dynamically generated at run-time.
This used to be easy in ASP.NET 1.x because everything was compiled
into a single assembly with a known name. In ASP.NET 2.0 each source
file ends up as a seperate assembly with a random name.
I have seen this question asked many times, but have not seen it
answered. Please help.