WonderfulTools.WonderfulCaptcha
10.2.0
dotnet add package WonderfulTools.WonderfulCaptcha --version 10.2.0
NuGet\Install-Package WonderfulTools.WonderfulCaptcha -Version 10.2.0
<PackageReference Include="WonderfulTools.WonderfulCaptcha" Version="10.2.0" />
paket add WonderfulTools.WonderfulCaptcha --version 10.2.0
#r "nuget: WonderfulTools.WonderfulCaptcha, 10.2.0"
// Install WonderfulTools.WonderfulCaptcha as a Cake Addin #addin nuget:?package=WonderfulTools.WonderfulCaptcha&version=10.2.0 // Install WonderfulTools.WonderfulCaptcha as a Cake Tool #tool nuget:?package=WonderfulTools.WonderfulCaptcha&version=10.2.0
Wonderful Captcha
Wonderful Captcha is a simple and customizable CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) implementation for .NET applications.
Features
- Generate custom CAPTCHA images with random text.
- Easily integrate CAPTCHA functionality into your .NET web forms or applications.
- Customizable CAPTCHA image size, font, text color, background color, and noise level.
Usage
1- You can install Wonderful Captcha via NuGet Package Manager:
Install-Package WonderfulCaptcha
2- Use extension To Add WonderfulCaptcha
using WonderfulCaptcha;
// use extension to add wonderfulcaptcha to project
builder.Services.AddWonderfulCaptcha();
3- Generate CAPTCHA image in controler, service, ...
[ApiController]
[Route("[controller]/[action]")]
public class TestController : ControllerBase
{
private readonly IWonderfulCaptchaService _wonderfulCaptchaService;
public TestController(IWonderfulCaptchaService wonderfulCaptchaService)
{
_wonderfulCaptchaService = wonderfulCaptchaService;
}
[HttpGet]
public async Task<ActionResult> GenerateAsync(CancellationToken cancellationToken)
{
var value = await _wonderfulCaptchaService.GenerateAsync(cancellationToken: cancellationToken);
return Ok(value);
}
}
4- Verify CAPTCHA
var result = await _wonderfulCaptchaService.VerifyAsync(key, value, cancellationToken);
Here's an improved version of your package markdown file:
Caching
When using WonderfulCaptcha, you have the flexibility to choose from various cache providers to optimize performance and resource management.
InMemoryCache
The InMemoryCache
provider is suitable for smaller applications or scenarios where you prefer an in-memory caching mechanism.
Installation
Install-Package WonderfulTools.WonderfulCaptcha.Cache.InMemory
Usage
builder.Services.AddMemoryCache();
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseInMemoryCacheProvider();
});
RedisCache
For larger applications or distributed environments, RedisCache
is an efficient choice due to its scalability and robustness.
Installation
Install-Package WonderfulTools.WonderfulCaptcha.Cache.Redis
Usage
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost:6379";
options.InstanceName = "MyRedisInstance";
});
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseRedisCacheProvider();
});
Custom Cache Provider
If you have specific caching requirements or wish to integrate with a different caching system, you can implement your own cache provider by implementing the ICacheProvider
interface.
Usage
- Implement your custom cache provider:
public class MyCacheProvider : ICacheProvider
{
// Your Implementation Here
}
- Register your custom cache provider:
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseCustomCacheProvider<MyCacheProvider>();
});
By providing these options, WonderfulCaptcha ensures compatibility with various caching strategies, allowing you to optimize your application's performance according to your specific needs.
In this version, I've organized the content into clear sections for each cache provider, provided clear installation and usage instructions, and improved the overall readability of the document. Additionally, I've added more descriptive text to explain the benefits and use cases of each cache provider.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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 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. |
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
- SixLabors.ImageSharp (>= 3.1.4)
- SixLabors.ImageSharp.Drawing (>= 2.1.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- SixLabors.ImageSharp (>= 3.1.4)
- SixLabors.ImageSharp.Drawing (>= 2.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on WonderfulTools.WonderfulCaptcha:
Package | Downloads |
---|---|
WonderfulTools.WonderfulCaptcha.Cache.InMemory
use in memory cache in wonderful captcha. |
|
WonderfulTools.WonderfulCaptcha.Cache.Redis
use Redis cache in wonderful captcha. |
GitHub repositories
This package is not used by any popular GitHub repositories.
migrate to new version of SixLabors.ImageSharp and add new strategy