Skip to main content

Posts

Showing posts with the label CAPTCHA

Captcha code Work Out

1.In Web.config file in handlers section 2.Add Captcha DLL to AddReferences 3.Aspx cc1:CaptchaControl ID="CaptchaControl1" runat="server" asp:Label ID="lbltext" Text="enter the above code here:" runat="server asp:TextBox ID="txtCaptch" runat="server" asp:Label ID="lblmessage" runat="server" 4.in button click write(Aspx.cs) if (!CaptchaControl1.UserValidated) { lblmessage.Text = "You Enterted Text Doesn't Match"; return; } else { lblmessage.Text = "Secuessfully entered"; CaptchaControl1.Visible = false; txtCaptch.Visible = false; lbltext.Visible = false; lblmessage.Visible = false; }

Recaptcha work done by me

1.In Web.config file in handlers section 2.Add Captcha DLL to AddReferences 3.Aspx 4.in button click write if (!CaptchaControl1.UserValidated) { lblmessage.Text = "You Enterted Text Doesn't Match"; return; } else { lblmessage.Text = "Secuessfully entered"; CaptchaControl1.Visible = false; txtCaptch.Visible = false; lbltext.Visible = false; lblmessage.Visible = false; }

val

RequiredFieldValidator This is one of the important controls used in majority of web applications. If a user fails to enter the required information on the form then the message given on this validation control will appear thereby forcing the user to fill up the required information. The code given below will illustrate this concept in detail Name: Age:    I have placed two textboxes and the required number of RequiredFieldValidator controls. The message given along with the ErrorMessage property will be displayed if the user doesn't enters any data on to the relevant text boxes (See the Figure given below) Figure 1

prefix

Button btn RadioButton rad CheckBox chk RadioButtonList radl CheckBoxList chkl TextBox txt DataGrid dgrd RequiredFieldValidator valr DataList dlst CompareValidator valc DrpDownList drop RangeValidator valg Image img RegularExpressionValidator vale ImageButton ibtn CustomValidator valx Label lbl ValidationSummary vals LinkButton lbtn Table tbl ListBox lst Calendar cal

DBLAYER

using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; namespace db2.API { public class DBLayer { SqlCommand ObjCmd; SqlDataAdapter ObjDa; DataSet ObjDs; SqlConnection Con = SqlConnection(ConfigurationManager.AppSettings["SqlCon"]); public int ExecuteNonQuery(string ObjStr, SqlParameter[] Parameter) { Con.Open(); ObjCmd = new SqlCommand(); ObjCmd.CommandType = CommandType.StoredProcedure; ObjCmd.CommandText = ObjStr; ObjCmd.Parameters.AddRange(Parameter); return ObjCmd.ExecuteNonQuery(); Con.Close(); } public int ExecuteScalar(string ObjStr, SqlParameter[] Parameter) ...