Home All Groups Group Topic Archive Search About

Dynamic loadcontrol of ascx with dll not in bin path

Author
15 Apr 2005 1:19 PM
manatlan
I try to make a framework in asp.net which will be able to manage some
ascx components.
I use a httphandler to render my webform, and fill it dynamically with
ascx components (with loadcontrol).
A "ascx components" is as "ascx page" and its "DLL codebehind".

It works like a charm when DLLs of ascx are placed in the "/bin
folder".
I'd like to be able to place them, (ascx+DLL together)  in a subfolder
of "/plugins folder" for examples.
But when i done that i've got a parse error :
"Parser Error Message: Could not load type 'XXX.YYY'"

Because asp.net is not able to find theses assemblies ...

- i've already tried to do
AppDomain.CurrentDomain.AppendPrivatePath("plugins/A;plugins/B;plugins/C"),
but it doesn't do nothing.
- i know it could be possible to do it by hacking the machine.config
or web.config. But i'd like to it in my code !

Do you know a solution to tell asp.net(or the usercontrol) to be able
to find the DLLs of my ascx, without putting then in the bin folder of
my root ???

thanx a lot

Author
15 Apr 2005 3:11 PM
Brock Allen
ASP.NET mandates implicit loading of assemblies from ~/bin or the GAC. You
can always call Assembly.LoadFrom, but I'm not sure if the LoadControl will
work with that. It's worth a try.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Show quoteHide quote
> I try to make a framework in asp.net which will be able to manage some
> ascx components.
> I use a httphandler to render my webform, and fill it dynamically with
> ascx components (with loadcontrol).
> A "ascx components" is as "ascx page" and its "DLL codebehind".
> It works like a charm when DLLs of ascx are placed in the "/bin
> folder".
> I'd like to be able to place them, (ascx+DLL together)  in a subfolder
> of "/plugins folder" for examples.
> But when i done that i've got a parse error :
> "Parser Error Message: Could not load type 'XXX.YYY'"
> Because asp.net is not able to find theses assemblies ...
>
> - i've already tried to do
> AppDomain.CurrentDomain.AppendPrivatePath("plugins/A;plugins/B;plugins
> /C"),
> but it doesn't do nothing.
> - i know it could be possible to do it by hacking the machine.config
> or web.config. But i'd like to it in my code !
> Do you know a solution to tell asp.net(or the usercontrol) to be able
> to find the DLLs of my ascx, without putting then in the bin folder of
> my root ???
>
> thanx a lot
>
Author
18 Apr 2005 7:53 AM
manatlan
i've tried Assembly.LoadFrom ... but loadcontrol doesn't use it

*** Sent via Developersdex http://www.developersdex.com ***