Programmatically logout an ASP.NET user

前端 未结 4 1747
小蘑菇
小蘑菇 2020-12-01 08:23

My app allows an admin to suspend/unsuspend user accounts. I do this with the following code:

MembershipUser user = Membership.GetUser(Guid.Parse(userId));
u         


        
4条回答
  •  一生所求
    2020-12-01 08:27

    On some common page, check for the account being valid, and if it's been revoked, call Session.Abandon().

    Edit (Just noticed this was still open.)

    I know this works, because I do it.

    On the master page, check the account status. That means on every navigation you have the chance to log them out.

    (Final) Edit

    Don't think of it as "I am terminating their session," think of it as "their session terminates itself."

提交回复
热议问题