我有一个宏来检测访问者是否来自Facebook,以及该访问者是否是该Facebook页面的管理员。
当我检测到管理员时,我运行以下代码将访问者作为预定义的管理员(Umbraco后端用户)登录并重定向到实时编辑模式。 这在Chrome中运行良好,但在Internet Explorer中无法正常工作。在Internet Explorer中,访问者被重定向到顶级(iframe外部)到Umbraco登录页面,未登录。任何想法为什么?
var id = umbraco.BusinessLogic.User.getUserId("exampleadminuser"); // LoginName of an administrator
var u = umbraco.BusinessLogic.User.GetUser(id);
umbraco.BasePages.BasePage.doLogin(u);
// Check if the user should be redirected to live editing
if (u.DefaultToLiveEditing)
{
int startNode = u.StartNodeId;
// If the startnode is -1 (access to all content), we'll redirect to the top root node
if (startNode == -1)
{
if (umbraco.cms.businesslogic.web.Document.GetRootDocuments().Length > 0)
{
startNode = umbraco.cms.businesslogic.web.Document.GetRootDocuments()[0].Id;
}
else
{
throw new Exception("There's currently no content to edit. Please contact your system administrator");
}
}
string redir = String.Format("{0}/canvas.aspx?redir=/{1}.aspx", GlobalSettings.Path, startNode);
Response.Redirect(redir, true);
}
答案 0 :(得分:0)
众所周知,canvas.aspx功能不可靠且不受支持,因此如果一个浏览器的反应不同,那就不足为奇了。在我的2级Umbraco证书课程中,导师和会议室中的每个人都认为它没有准备就绪。
我不能完全复制你的问题,但登录最新版本的Chrome,Firefox和IE9的后台办公室的Chrome是奇怪的 - IE9和Firefox以同样的方式做出反应。奇怪的是,Chrome是唯一一个不的人。
我正在登录umbraco,然后在每个实例中使用url激发另一个标签:
< .. domain ..> /canvas.aspx?redir = / pagename /
(我的网站将umbracoUseDirectoryUrls键设置为true,因此.aspx格式被尾部斜杠替换。)
所以我的答案是canvas.aspx不可靠,因此我会将管理员登录到标准/ umbraco /后台而不是信任canvas.aspx。