Stefan
Stefan

Reputation: 1729

Determine whether user is logged in

What's the best/most efficient way whether the user of my .NET web application is currently logged in.

I'm currently using Membership.GetUser() != null, but now that I realize that this involves a DB-roundtrip, I wonder if there's a better way. Maybe HttpContext.Current.User.Identity.IsAuthenticated?

Upvotes: 4

Views: 1070

Answers (1)

Joel Cunningham
Joel Cunningham

Reputation: 13730

You have answered your own question. The IsAuthenticated property is the best way to do this.

Upvotes: 6

Related Questions