AspNetCore.ReCaptcha
1.0.0
See the version list below for details.
dotnet add package AspNetCore.ReCaptcha --version 1.0.0
NuGet\Install-Package AspNetCore.ReCaptcha -Version 1.0.0
<PackageReference Include="AspNetCore.ReCaptcha" Version="1.0.0" />
paket add AspNetCore.ReCaptcha --version 1.0.0
#r "nuget: AspNetCore.ReCaptcha, 1.0.0"
// Install AspNetCore.ReCaptcha as a Cake Addin #addin nuget:?package=AspNetCore.ReCaptcha&version=1.0.0 // Install AspNetCore.ReCaptcha as a Cake Tool #tool nuget:?package=AspNetCore.ReCaptcha&version=1.0.0
AspNetCore.ReCaptcha
ReCAPTCHA Library for .NET Core 2.x/3.x/5.x.
Requirements
This package requires a secret key as well as a site key provided by ReCaptcha. You can aquire your keyset at https://www.google.com/recaptcha/intro/v3.html. It's possible to use either v2 or v3 ReCaptcha.
Installation
You can install this package using NuGet. You can use the following command:
# Package Manager
PM> Install-Package AspNetCore.ReCaptcha
# .NET CLI
dotnet add package AspNetCore.ReCaptcha
Configuration
Place the aquired secret key and site key in the appsettings.json of your project. An example of the appsettings file is below:
{
"ReCaptcha": {
"SiteKey": "your site key here",
"SecretKey": "your secret key here",
"Version": "v2"
}
}
Usage
To use AspNetCore.ReCaptcha in your project, you must add the following code to your startup.cs:
public void ConfigureServices(IServiceCollection services) {
services.AddReCaptcha(Configuration.GetSection("ReCaptcha"));
}
In your .cshtml file you add the following using statement:
@using AspNetCore.ReCaptcha
And then you can add the ReCaptcha element to your DOM using the following code:
@Html.ReCaptcha
The action that you will be posting to (in this case SubmitForm) will need the following attribute on the method:
[ValidateReCaptcha]
[HttpPost]
public IActionResult SubmitForm(ContactViewModel model)
{
if (!ModelState.IsValid)
return View("Index");
TempData["Message"] = "Your form has been sent!";
return RedirectToAction("Index");
}
Examples
For every version of .NET Core there is a configured example included in this repository. Check the Samples map for those examples.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
-
.NETCoreApp 2.1
- Microsoft.Extensions.Options (>= 2.1.1)
- System.Text.Json (>= 4.6.0)
-
.NETCoreApp 3.1
- Microsoft.Extensions.Options (>= 3.1.0)
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.8.2 | 26,866 | 7/20/2024 |
1.8.1 | 75,224 | 1/10/2024 |
1.8.0 | 5,465 | 12/28/2023 |
1.7.0 | 117,105 | 2/2/2023 |
1.6.0 | 85,432 | 9/28/2022 |
1.5.4 | 24,508 | 8/4/2022 |
1.5.3 | 41,485 | 3/16/2022 |
1.5.2 | 10,945 | 2/11/2022 |
1.5.1 | 1,628 | 2/3/2022 |
1.4.0 | 7,229 | 1/9/2022 |
1.3.0 | 2,841 | 12/11/2021 |
1.2.5 | 26,868 | 9/30/2021 |
1.2.3 | 17,027 | 7/20/2021 |
1.2.2 | 9,023 | 6/5/2021 |
1.2.1 | 14,149 | 3/15/2021 |
1.2.0 | 5,736 | 3/1/2021 |
1.1.0 | 2,087 | 4/24/2020 |
1.0.0 | 583 | 4/17/2020 |