I have a simple User Control Container based on the SmartPart's
technique of dynamically loading the ASCX file. I want to use a file
in 12\LAYOUTS\CONTROLTEMPLATES (for deployment reasons).
Additionally I've got my own codebehind stored in an assembly that I
can put into the <webroot>\bin or the GAC.
I think I'm having problems crossing virtual directory boundaries.
Surprisingly, I can get this to work with Full trust.
// Doesn't seem to matter if starts with "/" or "~/"
string _userControl = @"/_controltemplates/Custom/MyControl.ascx"
if (_userControl != defaultText)
{
_control = this.Page.LoadControl(_userControl);
}
I always get this:
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal
(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp,
Boolean allowBuildInPrecompile)
at
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert
(HttpContext context, VirtualPath virtualPath, Boolean noBuild,
Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath
virtualPath)
at System.Web.UI.TemplateControl.LoadControl(String virtualPath)
at
Quintiles.IntranetPortal2.WebParts.UserControlContainer.UserControlCo
ntainer.CreateChildControls()
Any ideas I can try?