代码之家  ›  专栏  ›  技术社区  ›  RaYell

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

  •  10
  • RaYell  · 技术社区  · 15 年前

    我的电脑里有一个登录视图APS.NET 具有匿名模板和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>
    

    所有事件处理程序都在代码隐藏文件中正确定义。

    问题是,如果用户登录,他将看到他的用户名和logonstatus控件的logout链接。单击注销链接将用户带回登录窗体(登录和注销窗体都是同一个用户控件的一部分),但是如果刷新页面,用户仍然登录。

    我注意到,如果我将LoginStatus控件移到LoginView之外,那么注销过程将按预期工作。我还注意到,当LoginStatus在LoginView中时,它不会引发loggingout事件。

    有人知道问题出在哪里吗?

    4 回复  |  直到 15 年前
        1
  •  2
  •   VFein    14 年前

    我也遇到了同样的问题。loginview控件之外的loginstatus控件可以根据需要工作。它在loginview控件中不起作用似乎很愚蠢。

    编辑**

      <sitecore>
        <rendering>
          <typesThatShouldNotBeExpanded>
            <type>System.Web.UI.WebControls.LoginView</type>
          </typesThatShouldNotBeExpanded>
        </rendering>
      </sitecore>
    

    Thank some other guy...

    -维克托F。

        2
  •  1
  •   Manish Prajapati    14 年前
    FormsAuthentication.SignOut()
    FormsAuthentication.RedirectToLoginPage()
    

    <system.web>
    <authorization>
      <allow users="?"/>
    </authorization>
    

        3
  •  1
  •   animuson    14 年前

    FormsAuthentication.SignOut();
    
        4
  •  0
  •   rick schott    15 年前

    你试过换衣服吗 LogoutAction LogoutAction="RedirectToLoginPage" OnLoggingOut 不需要事件。

    推荐文章