开发者

asp.net membership controls, Login1_LoggingOut is not called when clicking logout

I have a loging control that is nested within a loginview. When I click the logout link, my method `

protected void LoginStatus1_LoggingOut(object sender, EventArgs e)
        {
            Guid guidUserId = AuthenticatedUser.LoginUserID;
            if (guidUserId != new Guid())
            {
                PortalDataContext db = new PortalDataContext(AuthenticatedUser.ConnectionString);
                var user = AuthenticatedUser.GetUser(guidUserId);
                if (user != null)
                {
                    user.LastActivityDate = user.LastActivityDate.AddMinutes(-16);

                    db.SubmitChanges();
                }
            }
        }

` is never called. I think it has something to do with the nesting of the control within a login view. How can I get around this so I can updat开发者_Python百科e the database? I need to reset the users last activity window to 16 minutes ago so I can tell if the user is still in the system and inactive or if they have logged out completely.


Tried this and it worked for me. Are you sure your event is wired up?

    <asp:LoginView runat="server">
        <LoggedInTemplate>
            <asp:LoginStatus ID="LoginStatus1" runat="server" 
                LogoutAction="Redirect" LogoutPageUrl="Login.aspx"  OnLoggingOut="LoginStatus1_LoggingOut" />
        </LoggedInTemplate>
    </asp:LoginView>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜