【发布时间】:2023-06-09 00:38:01
【问题描述】:
我有一个流水线处理器,它在网站上按预期工作,但在您进入 CMS 时会造成严重破坏。
确定请求是否发往 CMS 的正确方法是什么? 最好我想要一些比检查 URL 是否包含“/sitecore/”更强大的东西。
【问题讨论】:
标签: sitecore pipeline processor
我有一个流水线处理器,它在网站上按预期工作,但在您进入 CMS 时会造成严重破坏。
确定请求是否发往 CMS 的正确方法是什么? 最好我想要一些比检查 URL 是否包含“/sitecore/”更强大的东西。
【问题讨论】:
标签: sitecore pipeline processor
站点上下文是执行此操作的好方法。您可以使用标准的 Sitecore 配置工厂方法来输入应该使用该扩展的站点名称,然后忽略其他名称,包括“shell”。
【讨论】:
如果您在“shell”站点中,您可以优雅地退出...
if (Sitecore.Context.Site.Name.Equals("shell", StringComparison.InvariantCultureIgnoreCase))
{
// Exit here if we're avoiding the sitecore shell altogether
return;
}
这取决于导致代码崩溃的情况。您可以检查页面模式以避免出现问题模式...
if (Sitecore.Context.PageMode.IsPageEditorEditing)
{
// Exit here if we're avoiding someone editing the page.
return;
}
【讨论】: