When we log on to a website or make a comment, we can place a verification code (CAPTCHA), which can be used for the system to eliminate the malicious refresh functions.
This insus.net is implemented in the ASP.net MVC application and demonstrates the generation and application of verification codes.
The day before yesterday, Insus.net has implemented a randomly generated string "get a random string in a asp.net MVC application http://www.cnblogs.com/insus/p/3619224.html, we can use this method later," Randomly generates a validation string.
In the application's handlers directory, create a generic handler named Captcha.ashx, which has a implemented IRequiresSessionState interface.
In controller, two action is created, the former is the View Method Captchademo () and the latter is the method of validating jquery. It has a parameter with it. The text box text for the validation code will be passed in. Within the method, the string that is randomly generated in ASPX is compared to the session to be correct or not.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/