Skip to main content
 首页 » 编程设计

c#之创建一个依赖于 Umbraco 母版页的 "normal"ASP.NET 页面

2024年02月20日13txw1958

是否有可能在 Umbraco 中创建一个继承主 Umbraco 母版页的普通 Web 表单页面?

我的客户需要一些复杂的功能,这些功能需要在 CMS 上下文之外的页面中完成。

我想知道是否可以从“普通”页面的构造函数中手动启动 Umbraco 上下文。目前我只是得到错误:

Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.item..ctor(IDictionary elements, IDictionary attributes) at umbraco.presentation.templateControls.ItemRenderer.GetFieldContents(Item item) at umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item) at umbraco.presentation.templateControls.Item.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at

谢谢 克里斯

请您参考如下方法:

您可以使用备用模板直接引用模板,而无需关联内容页面。

您可以通过以下方式引用它:

http://www.yourdomain.com/page.aspx?altTemplate=templatename

http://www.yourdomain.com/page/templatename.aspx

这将阻止用户删除节点。

这有帮助吗?