You need to write the UserExists like this because you are returning the value before then con.Close(); will not be executed.
private bool UserExit()
{
string strConnString = ConfigurationManager.ConnectionStrings["Constr"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand("Select * From tblFiles Where Name =@Name ");
cmd.Parameters.AddWithValue("@Name", "");
cmd.CommandType = CommandType.Text;
cmd.Connection = con; con.Open();
SqlDataReader rdr; rdr = cmd.ExecuteReader();
bool isAvailable = false;
if (rdr.HasRows)
{
isAvailable = true;
}
else
{
isAvailable = false;
}
con.Close();
return isAvailable;
}