Example #1
0
        protected void btnValid_Click(object sender, EventArgs e)
        {
            string capcharead = "";

            try
            {
                capcharead = Session["CaptchaVerify"].ToString();
            }
            catch
            {
                GenerarCaptcha();
                return;
            }


            if (txtVerificationCode.Text.ToLower() == capcharead)
            {
                autenticacionParticipanteService obj       = new autenticacionParticipanteService();
                AutenticacionParticipanteResult  logResult = obj.autenticacionParticipante(new autenticacionParticipanteParams {
                    correoUsuario = "1", claveUsuario = "1234"
                });

                if (logResult != null)
                {
                    if (logResult.EstadoLogin)
                    {
                        Session["id_RolParticipante"] = logResult.id_RolParticipante;
                        Session["id_Usuario"]         = logResult.id_Usuario;
                        Response.Redirect("/Views/Principal/ListaEventos.aspx");
                    }
                    else
                    {
                        AlertSesionError2.Visible = true;
                        GenerarCaptcha();
                        txtVerificationCode.Text = "";
                        //AlertCaptchaClose("AlertSesionError2");
                        //Response.Redirect("Login.aspx");
                    }
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            else
            {
                Session.Contents.RemoveAll();
                GenerarCaptcha();
                txtVerificationCode.Text    = "";
                lblCaptchaMessage.Text      = "Please enter correct captcha !";
                lblCaptchaMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Example #2
0
        protected void btnValid_Click(object sender, EventArgs e)
        {
            string capcharead = "";

            try
            {
                capcharead = Session["CaptchaVerify"].ToString();
            }
            catch
            {
                GenerarCaptcha();
                return;
            }
            int intento = Session["Intento"] == null ? 1 : int.Parse(Session["Intento"].ToString());

            if (txtVerificationCode.Text.ToLower() == capcharead)
            {
                autenticacionParticipanteService obj       = new autenticacionParticipanteService();
                AutenticacionParticipanteResult  logResult = obj.autenticacionParticipante(new autenticacionParticipanteParams {
                    correoUsuario = txtUsuario.Text, claveUsuario = txtContrasena.Text
                });

                if (logResult != null)
                {
                    if (logResult.EstadoLogin)
                    {
                        Session["id_RolParticipante"] = logResult.id_RolParticipante;
                        Session["id_Usuario"]         = logResult.id_Usuario;
                        Response.Redirect("/Views/Principal/ListaEventos.aspx");
                    }
                    else
                    {
                        AlertSesionError2.Visible = true;
                        GenerarCaptcha();
                        txtVerificationCode.Text = "";
                        AlertCaptchaClose("AlertSesionError2");
                        //Response.Redirect("Login.aspx");
                    }
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            else
            {
                //Session.Contents.RemoveAll();
                if (intento <= 3)
                {
                    ScriptManager.RegisterStartupScript(
                        this, // updatepanel
                        this.GetType(),
                        "MyAction",
                        "CerrarCapcha();",
                        true);
                }

                Session["Intento"] = intento++;
                GenerarCaptcha();
                txtVerificationCode.Text    = "";
                lblCaptchaMessage.Text      = "Please enter correct captcha !";
                lblCaptchaMessage.ForeColor = System.Drawing.Color.Red;
            }
        }