protected void Login_Click(object sender, EventArgs e) { if (errorView.Visible) { errorView.Visible = false; } AD.ADAccountManagement ADinterface = new AD.ADAccountManagement(); SQL sql = new SQL(); try { bool check = sql.authUser(user.Value.ToString(), pass.Value.ToString()); if (check) { FormsAuthentication.SetAuthCookie(user.Value.ToString(), false); Response.Redirect("~/Admin/Home.aspx"); } else { errorView.InnerText = "Bad Username or Password"; errorView.Visible = true; } } catch (Exception ex) { errorView.InnerText = "Error Validating account " + ex.Message.ToString(); errorView.Visible = true; } }