How to add and verify captcha codes on 3 tier login and registration page in applications

Hi friend, today we will learn "how to add and verify captcha codes on your existing 3 tier login and registration page in". I have already explained ,how to to create 3 tier login and registration page.But here i will explain "how to add and verify captcha codes in 3 tier login and registration page".If you want to add more features on your registration and login page, you can follow below links.
I have alreafy implemented more concepts separately , It is yours responsibility, how to use it in different .NET applications.Here we will learn how to add captcha(.dll) codes in 3 tier architecture.You can add another captcha codes(graph) also in this application.This is easy process but you have to follow some steps as given below:-

Step 1:-First Implement the complete 3 tier architecture concepts from step 1 to step 14  on your visual studio from Here . You can download whole 3 tier architecture codes .
Step 2:- You can download captcha.dll file from here.
Step 3:- Now open Solution Explorer --> Add New Folder Bin  --> Extract captcha dll files and paste it into Bin folder as shown below:-

Step 4:- Now  open Home.aspx file--> Go Source file--> Add Register Assembly codes on the top section as given below:-
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="rsv" %> 

Step 5:- Now Add Captcha codes  inside table tag (<tb>)as shown below:-
<td class="style3">
                <rsv:CaptchaControl ID="captcha1" runat ="server" CaptchaLength="5" 
                CaptchaHeight ="60" CaptchaWidth="200" CaptchaLineNoise="None" 
                CaptchaMinTimeout="5" CaptchaMaxTimeout="240" ForeColor="#00FFCC" 
                BackColor="White" CaptchaChars="ABCDEFGHIJKLNPQRTUVXYZabcdefghijklmnopqrstuvwxyz012346789" 
                FontColor="Red" />
Step 6:- After adding step 4 and step 5 codes ,you will see following image on your design page as shown below:-

Step 7:-Now open web.config file-->Write the following codes as given below:-
      <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha "/>
    <compilation debug="true" targetFramework="4.0">
    <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>

Note:- Above codes is more important to show the captcha codes on the web page.
Step 8:- Now Go  inside Register Now (Home.aspx.cs) button-->Update the c# codes as given below:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        if (captcha1.UserValidated)
            //Load or call Business object class in memory and get and set the value in variables
            Business_Object bo = new Business_Object();
            bo.Username_value = TextBox1.Text;
            bo.pass_value = TextBox2.Text;
            bo.Qualification_value = TextBox4.Text;
            bo.Age_value = TextBox5.Text;
            bo.mobile_value = TextBox6.Text;
            //call business layer class by creating object of business layer class
            Business_Layer bl = new Business_Layer();

                string result = bl.record_insert(bo);
                if (result != null)
                    //Label1.Text = "Data successfully inserted in database";
                    Label1.Text = "Try again...";

            catch (Exception info)
                throw info;
                bo = null;
                bl = null;
            Label2.ForeColor = System.Drawing.Color.Red;
            Label2.Text = "You have Entered InValid Captcha Codes";

Note :-When are making any application,please change the all control (Tex box ,label etc.) ID like Ex. TextBox1.Text =txtname.text for security purpose.I am using it just understanding purpose only.
Step 9:-Now run the application(press F5)-->Fill  all Details  as show below:-
Step 10:-Press Register Now Button-->You will see following output as shown below:-

For More

  1. How to implement all Web Form controls in
  2. Data List Real Application
  3. Repeater control Real application
  4. How to use session in application
  5. How to use Navigation control in
  6. How to implement web services in application
  7. How to use WCF Services in application.
  8. Create captcha image without dll file in
  9. How to create setup file with database
  10. How to Create photo gallery of your friends like facebook and google+
  11. How to build Your own window media player easily
  12. How to host your WCF services on your local computer and use it from other computers also
 Download whole attached file


Post a Comment

Powered by Blogger.