Use
Session
to solve the problem.
Example:
In your case for every user name has a unique ID. Put that ID in a
Session
like
Session["UserId"] = userid.ToString();
When successfully logged in.
Check in the login page:
if(Session["UserId"] != null)
{
redirect to another page.
}
When
u you logout use the below line to abandon(terminate) the
Session
.
HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();