views:

36

answers:

0

I have a LoginView in my APS.NET application with AnonymousTemplate and LoggedInTemplate. I've put LoginStatus control inside LoggedInTemplate but it doesn't work as expected.

Here's the code

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

All event handlers are correctly defined in code behind file.

The problem is that if user logs in he will see his user name with logout link from LoginStatus control. Clicking the logout link takes the user back to login form (both login and logout form are part of the same user control) but if I refresh the page the user is still logged in.

I've noticed that if I move LoginStatus control outside the LoginView then logout process works as expected. I've also noticed that when LoginStatus is inside LoginView then it doesn't raise a loggingout event.

Does anyone have any ideas what might be the problem?