public bool IsValid(UserAccount user) { DBA database = new DBA(); foreach (UserAccount USER in database.GetUsers()) { string hash = FormsAuthentication.HashPasswordForStoringInConfigFile(user.Password, "sha1"); if (USER.Username == user.Username && USER.Password == hash) { return(true); } } return(false); }