I have SQL Database with all my users. I want to use default login page of ASP.NET 4 WebSite Template. What should I change if user is past validation?
This is my Login button
protected void LoginButton_Click(object sender, EventArgs e)
{
string userName = LoginUser.UserName;
string password = LoginUser.Password;
DBAccess dba = new DBAccess();
DataTable dt = dba.GetUser(userName, password);
if (dt.Rows.Count > 0)
{
Session["UserID"] = dt.Rows[0]["UserID"].ToString();
string name = dt.Rows[0]["FirstName"].ToString() + " " + dt.Rows[0]["LastName"].ToString();
FormsAuthentication.SetAuthCookie(userName, true);
}
else
{
LoginUser.FailureText = "Wrong Password or User Name";
}
}
How to change HeadLoginStatus
and how to set Authentication to True?
Thank you for any help!