Can you recommend the CAPTCHA library for use with the ASP.NET MVC application?

If you included CAPTCHA in an ASP.NET MVC application, did you use some external CAPTCHA library? If so, would you recommend it and why?

+3
source share
3 answers
  • Do you use nuget? if you don’t, right-click on the link in your project and select the link for the ad library package
  • go to the online tab and install dll Microsoft Web Helpers
  • In this confirmation you will find a very handy helper that is ReCaptcha.GetHtml

You can use it in your view as shown below;

@ReCaptcha.GetHtml(ConfigurationManager.AppSettings["recaptcha-public-key"], "white")

recaptcah web.config, ConfigurationManager.AppSettings . http://www.google.com/recaptcha

, :

if (ReCaptcha.Validate(ConfigurationManager.AppSettings["recaptcha-private-key"])) { 

//the call is legitimate

} else {

// the call is not legitimate

}

, .

1 Uppps. _ViewStart.cshtml, ;

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ReCaptcha.PrivateKey = ConfigurationManager.AppSettings["recaptcha-private-key"];
    ReCaptcha.PublicKey = ConfigurationManager.AppSettings["recaptcha-public-key"];
}
+4

. MVCRecaptcha (https://mvcrecaptcha.codeplex.com/).

You can also download the package from Nuget, however, make sure that you do not download the other available Recaptcha packages that you need — you must specifically download MVC recaptcha.

Then follow the rest of the instructions on the MVC recaptcha codeplex website to start and run.

0
source

Source: https://habr.com/ru/post/1793021/


All Articles