我想在我的.aspx文档中包含一个文件,其中文件路径的一部分基于从函数收集的变量。
我已经尝试过了:
<!-- #include virtual="/<%=MyClass.GetDirectory() %>/include/pageFooter.aspx" -->但是会得到错误:解析器错误信息:路径中有非法字符。
我猜你不能把代码和include file/virtual一起使用。有没有等价物,这样我就可以让它工作了?
谢谢!
发布于 2014-06-17 18:37:02
我的第一个问题是,您为什么要尝试包含一个aspx?为什么不使用UserControl
然而,假设还有其他一些原因,我倾向于使用文本控件来做这类事情。
<asp:Literal ID="IncludeLiteral" runat="server" />然后在你的后台代码中
this.IncludeLiteral.Text = string.Concat(MyClass.GetDirectory(), @"/include/pageFooter.aspx");https://stackoverflow.com/questions/24261490
复制相似问题