【问题标题】:forcefully log out a specific user among all online users强制注销所有在线用户中的特定用户
【发布时间】:2012-05-09 07:10:55
【问题描述】:

在我的站点管理员可以查看所有其他在线用户的列表。

管理员还可以禁用该列表中的任何帐户。

到目前为止一切都很顺利。但现在我决定注销被禁用的用户。如何从上述指定的在线用户列表中为特定用户进行注销操作?

注意:我正在为我的 SQL Server 数据库使用默认成员资格架构。

【问题讨论】:

    标签: asp.net asp.net-membership logout


    【解决方案1】:

    您不能从会话之外的用户注销。请参阅Programatically logout an ASP.NET user 了解可能的解决方法。

    【讨论】:

    • 非常感谢。上面的链接对我帮助很大。我将以下代码添加到 page_load 事件中,它运行良好。 if (Page.User.Identity.IsAuthenticated) { MembershipUser user = Membership.GetUser(Page.User.Identity.Name); if (!user.IsApproved) { HttpContext.Current.Session.Abandon(); FormsAuthentication.SignOut(); Response.Redorect("Default.aspx"); } }
    猜你喜欢
    • 2019-04-30
    • 2017-05-17
    • 1970-01-01
    • 2011-07-26
    • 2016-11-04
    • 1970-01-01
    • 1970-01-01
    • 2020-08-14
    • 2014-10-25
    相关资源
    最近更新 更多