标签: c# .net authentication
我的.NET Web应用程序的用户当前是否登录是最好/最有效的方式。
我目前正在使用Membership.GetUser() != null,但现在我意识到这涉及到DB-roundtrip,我想知道是否有更好的方法。也许HttpContext.Current.User.Identity.IsAuthenticated?
Membership.GetUser() != null
HttpContext.Current.User.Identity.IsAuthenticated
答案 0 :(得分:6)
您已回答了自己的问题。 IsAuthenticated属性是执行此操作的最佳方式。
IsAuthenticated