George2
George2

Reputation: 45771

Forms authentication issue

I am using VSTS 2008 + C# + .Net 3.5 + ASP.Net + IIS 7.0. And I am implementing Forms authentication.

I want to know in Forms authentication, how to check whether a user is already authenticated or not?

Upvotes: 1

Views: 248

Answers (1)

keyboardP
keyboardP

Reputation: 69372

You can use HttpContext.Current.User.Identity.IsAuthenticated to check whether they're authenticated. For example

if(User.Identity.IsAuthenticated)
{
Response.Write("Logged in already");
}
else
{
Response.Write("Please log in");
}

Upvotes: 7

Related Questions