// this is a custom validator control tocheck username or password is correct or not
protected void CVC_ServerValidate(object source, ServerValidateEventArgs args)
{
string idsession = Session["tree_id"].ToString();
SqlConnection mysql = new SqlConnection(ConfigurationManager.ConnectionStrin gs["laxmi"].ConnectionString);
mysql.Open();
string sqlqry = "Select * from laxmivarsha.Account_Master where Account_ID = '" + txtaccountid.Text + "' And " +
" password = '" + txtpassword.Text + " ' and Flag = 'A' and Tree_id = '" + idsession + "' ";
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Connection = mysql;
sqlcmd.CommandText = sqlqry;
sqlcmd.CommandType = CommandType.Text;
SqlDataReader userdr = sqlcmd.ExecuteReader();
userdr.Read();
if (userdr.HasRows == true)
{
userdr.Close();
args.IsValid = true;
}
else
{
args.IsValid = false;
Response.Redirect("Invaliduser.aspx");
}
from mahendra - india
email : mahendra.developer@yahoo.com