asp.net成员资格控件,单击注销时不调用Login1\u Logging
我有一个嵌套在loginview中的登录控件。当我单击注销链接时,我的方法`asp.net成员资格控件,单击注销时不调用Login1\u Logging,login,asp.net-membership,Login,Asp.net Membership,我有一个嵌套在loginview中的登录控件。当我单击注销链接时,我的方法` protected void LoginStatus1_LoggingOut(object sender, EventArgs e) { Guid guidUserId = AuthenticatedUser.LoginUserID; if (guidUserId != new Guid()) { P
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();
}
}
}
`
从来没有人打过电话。我认为这与登录视图中控件的嵌套有关。我怎样才能避开这个问题,以便更新数据库?我需要将“用户上次活动”窗口重置为16分钟前,这样我就可以知道用户是否仍在系统中且处于非活动状态,或者他们是否已完全注销。尝试了这个方法,它对我有效。你确定你的活动已经准备好了吗
<asp:LoginView runat="server">
<LoggedInTemplate>
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="Redirect" LogoutPageUrl="Login.aspx" OnLoggingOut="LoginStatus1_LoggingOut" />
</LoggedInTemplate>
</asp:LoginView>
能否向我们展示LoginStatus控件的声明性标记?您可以设置一个属性,将其呈现为超链接而不是链接按钮-在这种情况下,当用户注销时不会回发。