这是简单的xslt,它显示当前用户的登录状态。在开发服务器上一切正常,但是一旦我们在生产环境中设置了应用程序,umbraco.librarty.IsLoggedOn()就会始终返回false。Umbraco.Library.IsLoggedOn()不适用于XSLT
应用程序使用.NET代码中的方法umbraco.libraty.IsLoggedOn(),并从那里返回适当的值,但来自xslt不。
<xsl:choose>
<xsl:when test="umbraco.library:IsLoggedOn() = true()">
You are logged in as
<q>
<xsl:variable name="user" select="umbraco.library:GetCurrentMember()/@loginName"/>
<xsl:value-of select="$user"/>
</q>. This is <a href="/profile">your profile</a>.
</xsl:when>
<xsl:otherwise>
You are not logged in.
<a href="/registruj-se">Log in</a>.
</xsl:otherwise>
</xsl:choose>
对于非开发人员一把umbraco:在library.IsLoggedOn()函数检查HttpContext.Current.User和HttpContext.Current.User.Identity.IsAuthenticated看到,如果你是会员或访客。
也许这是Cookie和XSLT的问题?任何人都有线索? TNX
嗨riffnl,tnx为你解答。最初它只是IsLoggedOn(),然后,我通过Umbraco论坛上的建议将它更改为IsLoggedOn()= test()。 – 2010-07-30 16:09:11
您可以添加IsLoggedOn()来输出:来查看实际值是什么? –
riffnl
2010-08-01 11:17:40
实际值为'假'。但是,这是配置问题,而不是xslt。请参阅下面的答案。 TNX寻求帮助 – 2010-08-02 09:32:32