CaptchaNoJS 1.0.1

.NET 6.0
dotnet add package CaptchaNoJS --version 1.0.1
NuGet\Install-Package CaptchaNoJS -Version 1.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="CaptchaNoJS" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CaptchaNoJS --version 1.0.1
#r "nuget: CaptchaNoJS, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CaptchaNoJS as a Cake Addin
#addin nuget:?package=CaptchaNoJS&version=1.0.1

// Install CaptchaNoJS as a Cake Tool
#tool nuget:?package=CaptchaNoJS&version=1.0.1

CaptchaNoJS

CaptchaNoJS protects ASP.NET/Core forms from spam, it's a self-hosted .NET library: no 3rd-party servers are involved in the generation, displaying, and validation of Captcha challenges.

Captcha.CaptchaType.Line

download

Captcha.CaptchaType.Circle

download

Usage example

Controller :
// GET: Example/Create
public IActionResult Create()
{
    Captcha captcha = new Captcha(200, 80, 6);
    ViewData["b64"] = captcha.GenerateAsB64(); // or captcha.GenerateAsB64(Captcha.CaptchaType.Circle);
    HttpContext.Session.SetString("captchaAnswer", captcha.GetAnswer());
    return View();
}
// POST: Example/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(String captcha)
{
    if (captcha == HttpContext.Session.GetString("captchaAnswer")) {
  ....
    }
}
View :
<form asp-action="Create">
    <div class="form-group">
        <label for="Captcha"> Captcha </label>
        <img src='data:image/Png;base64,@ViewData["b64"]' />
        <input type="text" class="form-control" name="captcha" />
   </div>
   <div class="form-group">
        <input type="submit" value="Save" class="btn btn-primary" />
   </div>
</form>
Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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.1 153 6/28/2022
1.0.0 149 6/15/2022