在Sitecore的,如何更改或设置PageMode [英] In Sitecore, how to change or set PageMode

查看:243
本文介绍了在Sitecore的,如何更改或设置PageMode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Sitecore的,我谁正在使用的编辑丝带将内容添加到页面的用户。不过,也有一些网页,我想prevent从用户的角色编辑模式完全。这是基于关闭一个分支的模板,所以我不能随便撤销对每个页面的权限。我需要一些方法来设置Sitecore.Context.PageMode是正常的。

有没有一个API,用于设置PageMode?

解决方案

虽然我无法找到一个C#API,我也发现,我可以只使用一个URL重定向,看起来是这样的:

 如果(Sitecore.Context.PageMode.IsNormal&安培;!&安培;!IsAdministrator())
        {
            字符串ID = Sitecore.Context.Item.ID.ToString();
            的Response.Redirect(/ sc_mode =正常和放大器; sc_itemid =+ ID +&放大器; sc_lang = EN);
        }

这将设置PageMode为正常,如果它在任何其他国家。

In Sitecore, I have users who are using the editing ribbon to add content to pages. However, there are some pages that I want to prevent EditMode completely from that user's role. This is based off of a branch template, so I can't just revoke privileges for each page. I need some way to set the Sitecore.Context.PageMode to be Normal.

Is there an API for setting the PageMode?

解决方案

While I was unable to find a C# API, I did find that I could just use a URL Redirect that looks something like this:

        if (!Sitecore.Context.PageMode.IsNormal && !IsAdministrator())
        {
            String id = Sitecore.Context.Item.ID.ToString();
            Response.Redirect("/?sc_mode=normal&sc_itemid=" + id + "&sc_lang=en"); 
        }

This will set the PageMode to Normal if it in any other state.

这篇关于在Sitecore的,如何更改或设置PageMode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆