This sample code shows login validation But DO NOT use this code to validate user login
con.Open();
SqlCommand cmd=new SqlCommand ("select count(*) from login where user=@u and pass=@p",con);
cmd.Parameters.Add("@u", SqlDbType.Varchar, 10).Value=TextLogin.Text.Trim();
cmd.Parameters.Add("@p", SqlDbType.Varchar,10).Value=TextPwd.Text.Trim();
int count=(int)cmd.ExecuteScalar();
if(count >0)
{
Response.Redirect("Default.aspx");
}
else
{
LabelError.Text="Invalid User Name or Password";
}