I have a virtual directory inside of my main virtual directory in IIS.
can i reference the parent application and reference its master page? If yes, how?
I have a virtual directory inside of my main virtual directory in IIS.
can i reference the parent application and reference its master page? If yes, how?
出于所有意图和目的,不,这是不可能的。ASP.NET 不会在其 AppDomain 之外执行 ASPX/ASCX/MASTER。我建议您使用您的解决方案走不同的路线(例如,编译成通用 dll)
编辑:要问的一个潜在问题是您是否需要虚拟目录。是什么让你首先选择将它们分开?
除此之外,您可能会通过编写自己的虚拟路径提供程序来伪造它,但这会导致世界受到伤害(基类未编译等)。
我建议您选择最简单的解决方案。
令我惊讶的是,这是可能的——如果您创建一个指向父应用程序中的母版页文件夹的虚拟目录。例如:
使用此设置,这可以在您的孩子 web.config 中工作:
<pages masterPageFile="~/Master/Default.master">
我假设在 @Page 指令中对其他母版页的引用会起作用,但我还没有尝试过。
不,出于安全考虑,我认为这是不可能的。