LoginView中的ASP.NET LoginStatus不会触发LoggingOut事件

我的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>

Thank some other guy…

-Victor F.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....