我的APS.NET应用程序中有一个LoginView与Anonymoustemplate和LoggedInTemplate.我已经把LoginStatus控件放在LoggedInTemplate里面,但是没有按预期的方式工作.
这是代码
<asp:LoginView ID="LoginView1" runat="server"> <Anonymoustemplate> <asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate" displayRememberMe="False" PasswordRecoveryUrl="/" DestinationPageUrl="/"> </asp:Login> </Anonymoustemplate> <LoggedInTemplate> You are logged in as <asp:LoginName ID="LoginName1" runat="Server"></asp:LoginName>. <asp:LoginStatus ID="LoginStatus1" runat="server" logoutAction="Redirect" logoutPageUrl="/" onloggingout="LoginStatus1_LoggingOut" /> </LoggedInTemplate> </asp:LoginView>
问题是,如果用户登录,他将从LoginStatus控件看到他的用户名与注销链接.单击注销链接将用户返回到登录表单(登录和注销表单都是同一用户控件的一部分),但是如果刷新页面,则用户仍然登录.
我注意到,如果我在LoginView之外移动LoginStatus控件,那么注销过程按预期工作.我也注意到,当LoginStatus在LoginView中时,它不会引发注销事件.
有谁有任何想法可能是什么问题?
解决方法
我在这里遇到同样的问题. loginview控件外面的loginstatus控件可以根据需要工作.看起来很愚蠢,它不能在loginview控件中工作.
编辑**
好的,所以我在Sitecore里遗漏了这个页面.显然Sitecore以某种方式介入loginview控件,并且必须添加到web.config中的以下部分:
<sitecore> <rendering> <typesthatShouldNotBeExpanded> <type>System.Web.UI.WebControls.LoginView</type> </typesthatShouldNotBeExpanded> </rendering> </sitecore>
-Victor F.