I am working on Validate Captcha
1: if user enter incorrect captcha then its shows error message "incorrect", How do i implement
<div> <cc1:CaptchaControl ID="cptCaptcha" runat="server" CaptchaBackgroundNoise="Low" CaptchaLength="5" CaptchaHeight="60" CaptchaWidth="200" CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" FontColor="#529E00" />
<asp:TextBox ID="txtCaptcha" runat="server" CssClass="form-control"></asp:TextBox> <br />
<asp:RequiredFieldValidator runat="server" Text="*" CssClass="text-danger" ControlToValidate="txtCaptcha" ErrorMessage="Enter Captcha"></asp:RequiredFieldValidator> <asp:Label ID="lblErrorMessage" runat="server" Font-Names="Arial" Text=""></asp:Label> </div>
protected void btnLogin_Click(object sender, EventArgs e) { var db = new DatabaseContext();
var ab= db.login.Where(x => x.MobileNumber == txtMobileNumber.Text.ToString()).FirstOrDefault();
if (applicant == null) { lblMessage.Text = "Mobile number is not registered!"; return; }
if (btnLogin.Text == "Get OTP") {
Session["LoginOtp"] = "*****";
pnl_Otp.Visible = true; txtMobileNumber.Enabled = false; btnLogin.Text = "Submit";
txt_Otp.Focus();
} else { if (Session["LoginOtp"].ToString() != txt_Otp.Text) { lblMessage.Text = "Invalid OTP";
return; } else { if (!ab.IsComplete) { Session["Username"] = applicant.MobileNumber; Session["Id"] = applicant.Id; Response.Redirect("~/index/default); } else { Session["Username"] = applicant.MobileNumber; Session["Id"] = applicant.Id; Session["usertype"] = "0"; Session["Type"] = applicant.Type;
Response.Redirect("~/Type/Default");
}
} }