ASP.NET登录/成员资格-如何注销?
我正在使用ASP.NET登录/成员资格-如何注销?,asp.net,login,asp.net-membership,umbraco,login-control,Asp.net,Login,Asp.net Membership,Umbraco,Login Control,我正在使用控件(以及) 我以A身份成功登录 然后我退出。 如果我以B身份登录,则当前用户仍然是A (和HttpContext.Current.User.Identity.Name都显示A) 我必须清除cookies才能完全注销 为什么.NET登录控件不能正确地将我注销?有人知道吗 编辑:我向大家道歉!这是一个Umbraco bug。我忘了在注销时使用UmbracoMembershipProvider来完全清除我将使用的登录用户: Session.Clear() Session.Abandon()
控件(以及
)
我以A身份成功登录然后我退出。
如果我以B身份登录,则当前用户仍然是A
(
和HttpContext.Current.User.Identity.Name
都显示A)
我必须清除cookies才能完全注销
为什么.NET登录控件不能正确地将我注销?有人知道吗
编辑:我向大家道歉!这是一个Umbraco bug。我忘了在注销时使用UmbracoMembershipProvider来完全清除我将使用的登录用户:
Session.Clear()
Session.Abandon()
FormsAuthentication.SignOut()
FormsAuthentication.RedirectToLoginPage()
我会接受艾拉的回答,因为我的问题错了 这是Umbraco错误的解决方案: 将onloggedout添加到登录状态
<asp:LoginStatus ... onloggedout="UmbracoLogout" />
(from)您说过:“如果我以B身份登录,当前用户仍然是A。”您能告诉我们您是如何发现该用户仍然是A的吗?页面\控件是否缓存了?您到底是如何注销的?注销时,您应该调用会话。放弃,然后重定向到登录页面,并在调试器中检查context.current.user.isauthenticated此时是否为false。我在我的登录状态中添加了onloggedout,如下所示
,此受保护的void LoginStatus1\u LoggedOut(对象发送方,事件参数e){Session Clear();Session.about();FormsAuthentication.SignOut();string user=HttpContext.Current.user.Identity.Name;//但这仍然显示了一个!FormsAuthentication.RedirectToLoginPage();}
很抱歉,我不能在那里换行。简而言之,我已经按照你的建议做了,但是没有清除HttpContext.Current.User.Identity.Name
对不起,算了吧,这是一个Umbraco错误!
protected void UmbracoLogout(object sender, EventArgs e)
{
Member.RemoveMemberFromCache(Member.CurrentMemberId());
Member.ClearMemberFromClient(Member.CurrentMemberId());
}