ASP. net mvc Verification Code demonstration

Source: Internet
Author: User

When we log on to a website or handle a comment, we can place a verification code (Captcha) to avoid malicious refresh and other functions for the system.

This time, Insus. NET has implemented and demonstrated the generation and application of verification codes in the asp.net mvc application.

The day before yesterday, Insus. NET has implemented the random generation of a string named "random acquisition of a string in ASP. net mvc application.

 

Under the Handlers directory of the application, create a Generic Handler named Captcha. ashx, which implements the IRequiresSessionState interface.

 

In the Controller, create two actions. The former is the view method CaptchaDemo (), and the latter is the jQuery verification method. It has a parameter. The text box of the verification code is passed in. In the method, it is correct to compare it with the string randomly generated in aspx and stored in the Session.

 

Reference view code:

 

Demo:

 

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.