You can code as below for redirect page based on condition:
protected void btn_login_Click(object sender, EventArgs e)
{
try
{
System.Data.SqlClient.SqlDataAdapter sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter("your query", "connectionstring");
DataSet dsResult = new DataSet();
sqlDataAdapter.Fill(dsResult);
if (dsResult.Tables[0].Rows.Count > 0)
{
redirect to home.aspx
}
else
{
redirect to userdetailedit.aspx
}
}
catch (Exception ex)
{
throw ex;
}
}