代码之家  ›  专栏  ›  技术社区  ›  Stefan

确定用户是否已登录

  •  4
  • Stefan  · 技术社区  · 17 年前

    无论我的.NET web应用程序的用户当前是否登录,最好/最有效的方法是什么。

    我目前正在使用 Membership.GetUser() != null ,但现在我意识到这涉及到DB往返,我想知道是否有更好的方法。大概 HttpContext.Current.User.Identity.IsAuthenticated ?

    1 回复  |  直到 17 年前
        1
  •  6
  •   Joel Cunningham    17 年前

    你已经回答了你自己的问题。这个 IsAuthenticated 房地产是实现这一目标的最佳方式。