Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
- {
- SqlConnection conn = new SqlConnection("Data Source=sqlserver01.webint.com.br;Initial Catalog=webint;Persist Security Info=True;User ID=webint;Password=igor1990");
- string sql = "select email, senha from tb_usuarios where email = @email and senha = @senha)";
- try
- {
- SqlCommand valor = new SqlCommand(sql, conn);
- valor.Parameters.Add(new SqlParameter("@senha", Login1.Password));
- valor.Parameters.Add(new SqlParameter("@email", Login1.UserName));
- conn.Open();
- valor.ExecuteNonQuery();
- conn.Close();
- RegisterClientScriptBlock("cadastrado", "<script>alert(Operação concluida !)</script>");
- }
- catch
- {
- RegisterClientScriptBlock("naoCadastrado", "<script>alert(Operação não concluida !)</script>");
- }
- finally
- {
- conn.Close();
- }
- /*
- if ((Login1.UserName == "admin") && (Login1.Password == "123"))
- {
- e.Authenticated = true;
- FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
- Response.Redirect("InserirRegistro.aspx");
- }
- else
- {
- e.Authenticated = false;
- }
- * */
- }
Add Comment
Please, Sign In to add comment