DNMOFT.reCAPTCHA.MVC 1.0.0.1

dotnet add package DNMOFT.reCAPTCHA.MVC --version 1.0.0.1
NuGet\Install-Package DNMOFT.reCAPTCHA.MVC -Version 1.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DNMOFT.reCAPTCHA.MVC" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DNMOFT.reCAPTCHA.MVC --version 1.0.0.1
#r "nuget: DNMOFT.reCAPTCHA.MVC, 1.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DNMOFT.reCAPTCHA.MVC as a Cake Addin
#addin nuget:?package=DNMOFT.reCAPTCHA.MVC&version=1.0.0.1

// Install DNMOFT.reCAPTCHA.MVC as a Cake Tool
#tool nuget:?package=DNMOFT.reCAPTCHA.MVC&version=1.0.0.1

How to Set reCAPTCHA Key in Web.config File

In the appSettings section of your web.config file, add the keys as follows:

<appSettings>
<add name="reCaptchaPublicKey" value="Your site key" />
<add name="reCaptchaPrivateKey" value="Your secret key" />
</appSettings>

Note: The appSettings keys are automatically added to your web.config file if you install reCAPTCHA for .NET through Nuget. However, you would still need to provide your own public and private keys in the web.config file of your project. How to Use reCAPTCHA in MVC Web Application Add the reCAPTCHA Control to Your MVC View

@using DNMOFT.reCAPTCHA.MVC
@using (Html.BeginForm())
{
    @Html.Recaptcha(publicKey:"xxxxxxxxxxxxx",theme: CaptchaTheme.Dark,type:CaptchaType.Image, 
            callback: "verifyCallback",expiredCallback:"expiredCallback")

    
    @Html.Recaptcha()

    @Html.ValidationMessage("ReCaptcha")
    <input type="submit" value="Register" />
}

reCAPTCHA Callback

<script>
var verifyCallback = function (response) {
    alert("grecaptcha is ready!");
};

var expiredCallback = function () {
    alert("grecaptcha is expired!");
};
</script>
public class HomeController : Controller
{
    [HttpPost]
    [CaptchaValidator(
        PrivateKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        ErrorMessage = "Invalid input captcha.",
        RequiredMessage = "The captcha field is required.")]
    public ActionResult Index(RegisterModel registerModel, bool captchaValid)
    {
        if (ModelState.IsValid)
        {

        }

        return View(registerModel);
    }
}
@using (Ajax.BeginForm("Index", "Home", new AjaxOptions { OnBegin = "onBeginSubmit" }))
{
    @Html.Recaptcha(theme: CaptchaTheme.Dark)
         
    <input type="submit" value="Register" />
}
<script>
    var onBeginSubmit = function () {
        var v = grecaptcha.getResponse();
        if (v.length == 0) {
            alert("You can't leave without Captcha.");
            return false;
        }
    };
</script>
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.1 882 5/31/2019
1.0.0 492 5/31/2019

--> Removed the Audio type

--> Added the Invisible button type