Sitepoint.AltchaCaptcha 1.0.0

dotnet add package Sitepoint.AltchaCaptcha --version 1.0.0
                    
NuGet\Install-Package Sitepoint.AltchaCaptcha -Version 1.0.0
                    
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="Sitepoint.AltchaCaptcha" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sitepoint.AltchaCaptcha" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Sitepoint.AltchaCaptcha" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sitepoint.AltchaCaptcha --version 1.0.0
                    
#r "nuget: Sitepoint.AltchaCaptcha, 1.0.0"
                    
#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.
#:package Sitepoint.AltchaCaptcha@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sitepoint.AltchaCaptcha&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Sitepoint.AltchaCaptcha&version=1.0.0
                    
Install as a Cake Tool

Sitepoint.AltchaCaptcha

Sitepoint.AltchaCaptcha is a lightweight community C# integration package for the ALTCHA proof-of-work CAPTCHA system.

It provides:

  • A self-contained client widget (static assets)
  • A typed service layer for communicating with a self-hosted ALTCHA backend
  • Simple dependency injection registration for .NET / Umbraco 13 applications

Features

  • Works with Umbraco 13 and any .NET 8 web app
  • Built-in options pattern (IOptions<T>)
  • Optional HTTP client for server-side verification
  • Ships with the ALTCHA widget JS + CSS
  • Minimal dependencies (only standard .NET abstractions)

Installation

Add the NuGet package:

dotnet add package Sitepoint.AltchaCaptcha

Configuration

In your Program.cs:

builder.Services.AddAltchaCaptcha(options =>
{
    options.ApiKey = builder.Configuration["SitepointCaptcha:ApiKey"]!;
    options.SiteKey = builder.Configuration["SitepointCaptcha:SiteKey"]!;
    options.VerifyChallengeUrl = builder.Configuration["SitepointCaptcha:VerifyUrl"]!;
});

Usage

In a Razor view or partial:


<script src="/altcha-widget.js" type="module"></script>

<form method="post" asp-action="Submit">
    <altcha-widget challengeurl="https://localhost:5000//captcha/generate/<siteKey>"></
    <altcha-widget>
        <button type="submit">Submit</button>
</form>

Verification Example

In your controller:

public class ContactController : Controller
{
    private readonly ICaptchaValidationService _captchaValidationService;

    public ContactController(ICaptchaValidationService captchaValidationService) => _captchaValidationService = captchaValidationService;

    [HttpPost]
    public async Task<IActionResult> Submit(ContactFormModel model)
    {
       
        if (!ModelState.IsValid)
        {
            return CurrentUmbracoPage();
        }

        var validationResult = await _captchaValidationService.ValidateAsync(HttpContext.Request.Form["altcha"]);

        if (!validationResult.IsValid)
        {
            TempData["CaptchaNotValid"] = true;
            return CurrentUmbracoPage();
        }

        TempData["FormSubmitted"] = true;
        return RedirectToCurrentUmbracoPage();
    }
}

License

This package is licensed under the MIT License (see LICENSE file).

Portions of this software are derived from the ALTCHA project and the Ixnas.AltchaNet C# library, both licensed under MIT.


About

This package is developed and maintained by Site Point as a community C# integration layer for self-hosted ALTCHA deployments.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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 272 10/20/2025