I have written a VirtualPathProvider to change how aspx pages are loaded into my ASP.Net application. As part of this process I have removed Code-Behind files and I am simpl
Your page must use the full specified class location - i.e. Inherits="MyNamespace.MyClass, MyAssembly"
.
Then loading the assembly into the appDomain is not going to help AppDomain resolve it. It doesn't walk the dynamically loaded assemblies. So you must subscribe for the AppDomain.ResolveAssembly event.
private Assembly myDynamicAssembly = null;
protected void Application_Start( object sender, EventArgs e )
{
myDynamicAssembly = Assembly.LoadFrom( Server.MapPath( "MyLocation/MyAssembly.dll" ) );
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( CurrentDomain_AssemblyResolve );
}
Assembly CurrentDomain_AssemblyResolve( object sender, ResolveEventArgs args )
{
if ( args.Name == "MyAssembly" )
{
return myDynamicAssembly;
}
return null;
}
And you're done. Now the runtime knows how to resolve classes from this dynamically loaded assembly.