I am trying to load a user control dynamically using this code:
UserControl homePageContent = Page.LoadControl(userControlPath) as UserControl;
I get the following error on the above line when the trust level is Medium:
System.Security.SecurityException: Request failed.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)...
Is it really not possible to load a user control dynamically in a Medium Trust environment?
Edit: Putting DLL in GAC is also not allowed.
Thanks in advance!