我有一个宏可以检测访问者是否来自Facebook,并且该访问者是该Facebook页面上的管理员。只有在使用Internet Explorer时才重定向到Umbraco登录
当我检测到管理员时,我运行下面的代码以访问者身份作为预定义的管理员(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);
}
这就是我最终做的,回答标记为正确的 – Sindre 2013-06-10 12:15:31