2013-03-13 46 views
0

我有一個管道處理器,它在網站上按預期工作,但是當你進入CMS時會造成嚴重破壞。Sitecore管道處理器搞亂了CMS

什麼是確定請求是否適合CMS的正確方法? 最好我想要比檢查URL是否包含「/ sitecore /」更強大一點。

回答

3

您可以正常退出,如果你在「殼」網站...

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; 
} 
+0

謝謝。這是一個很好的答案。顯然,確定上下文站點是否是「Shell」的關鍵在於。說實話,我還沒有意識到CMS作爲這個網站運行。 – 2013-03-14 18:38:42

+0

我選擇以前的答案作爲接受的答案,因爲它更具可配置性,但都適用於我的目的。 – 2013-03-14 18:40:34