How to add a validation code to the ASP solution

Source: Internet
Author: User
Tags numeric value rar trim
Resolution | Verification Code | Code 1, download file

Imgchk.rar:http://www.blueidea.com/articleimg/2005/08/2671/imgchk.rar

The compressed package is a Imgchk folder with three files: Validatecode.asp,validatebody.fix,validatehead.fix

The main is to generate the authentication Code service.

Release the unzipped folder directly in the same directory where you need to add a captcha to a page (for example, addnew.asp needs to add a CAPTCHA, which is under the Cnbruce folder, the Imgchk folder is released to the Cnbruce folder at the same time)

2, add display verification code and input box

Add the following code to the page where you want to add the authentication code:

<input name= ' validatecode ' type= ' text ' size= ' 5 ' >

3. Record Accept page Processing

In step 2, you must submit the records to a page, and then add the following code to the processing page:


If Trim (Request.Form ("Validatecode")) =empty Or Trim (Session ("Cnbruce.com_validatecode")) <>trim (Request.Form ("Validatecode")) Then
Response.Write ("Please note the correct input of the verification Code")
Response.End
End If

Verification Code principle:

When you generate a CAPTCHA picture, a session is generated with the value of the numeric value in the Captcha picture.

At the same time, provide input box for user input, submit input value, compared with the existing session value, according to the judgment result make corresponding judgment.

If you need to modify the name of the session, only two places are changed:

A: You download the Imgchk folder in the validatecode.asp, which involves the cnbruce.com to your;

B: Just step 3 of the Trim (session ("Cnbruce.com_validatecode")) <>trim (Request.Form ("Validatecode")) The cnbruce.com in is changed to a set.

In addition ===================================================
Show the check code patch (some friends show no verification code, here to see)

Create a file Sp2.reg with the following content (Notepad, save As)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Security]
"BLOCKXBM" =dword:00000000

Double-click the Import registry, and then restart the machine.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.