Generates a captcha image for a Blazor Server application. For use with .NET 9.0 or higher Blazor applications
$ dotnet add package BlazorCaptchaGenerates a captcha image for a Blazor Server or Webassembly application.
Blazor webassembly : https://tossnet.github.io/Blazor-Captcha/
[!WARNING] ⚠️ WebAssembly Demo Currently Broken ⚠️
The live demo on GitHub Pages is currently not working due to a SkiaSharp initialization error:
Uncaught ManagedError: TypeInitialization_Type, SkiaSharp.SKImageInfoThe component works correctly locally (both debug and release), but fails when deployed to GitHub Pages. This issue appeared after version 2.0.2 and persists despite rollback attempts.
🙏 Help Wanted: If you have experience with SkiaSharp + Blazor WebAssembly deployment issues and find a solution, please open an issue using our template or submit a PR - it would be greatly appreciated!
Related discussion: https://github.com/mono/SkiaSharp/discussions/3185

To Install
Install-Package BlazorCaptcha
or
dotnet add package BlazorCaptcha
For client-side and server-side Blazor - add script section to _Host.cshtml (head section)
<link href="_content/BlazorCaptcha/captcha.css" rel="stylesheet" />
@page "/"
@using BlazorCaptcha
<h3>Hello, world!</h3>
<Captcha @bind-CaptchaWord="@Captcha" CharNumber="@CaptchaLetters" />
<p>@Captcha</p>
@code{
private string Captcha = "";
private int CaptchaLetters = 5;
protected override Task OnInitializedAsync()
{
Captcha = BlazorCaptcha.Commun.Tools.GetCaptchaWord(CaptchaLetters);
return base.OnInitializedAsync();
}
}
- Fix NuGet packaging:
BlazorCaptcha.Communis now embedded directly (no separate package dependency)- Resolves error
NU1101: Unable to find package BlazorCaptcha.Commun
- Add .NET 10 support
- Code optimization
- Captcha improvement
- Change license to MIT
- Due to the Skiasharp problem : https://github.com/mono/SkiaSharp/discussions/3185#discussioncomment-12410708,a special component for Blazor WebAssembly has been created. Currently only compatible with .NET 8 for the WASM part
- .NET 7 compatibility removed
- issue #12
- Add DotNet 8.0 framework target
- Update nuget packages
- To avoid any confusion, remove 'x', 'V', 'v' chars
- issue #10 Characters did not always fit inside the div
- remove 'X' and '+' chars
- migrate to .NET 7
- minor improvement
- Add type="button"
- add nuget package SkiaSharp.NativeAssets.Linux
- NET6, removal of the bootstrap class
- Change the parameter "CaptchaWord" => "@bind-CaptchaWord"
- Add the parameter with the length of the word ex : "CharNumber="@CaptchaLetters"
- Remove the "OnRefresh" parameter