For Your Question comment
>Ok I have visited that and then I want to validate that login control's username and >the password from a table that in a SQL database. Then how am I going to do that? >Please help me!
I guess is this ur requirement.
SqlConnection conn = new SqlConnection();
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
conn.Open();
string username = TextBox1.Text;
string password = Textbox2.Text;
SqlCommand cmd = new SqlCommand("Select uname, pswd from emp_details where uname =@uname and pswd =@ps", conn);
cmd.Parameters.Add(new SqlParameter("@uname", "username"));
cmd.Parameters.Add(new SqlParameter("@ps", "password"));
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
dr.close();
Session["username"] = txtusername.Text;
Session["password"] = txtpassword.Text;
}
else
{
dr.close();
msg.Showalert("Invalid username or password");
}
con.close();
}