EasyCaptchaCore 1.0.0
See the version list below for details.
dotnet add package EasyCaptchaCore --version 1.0.0
NuGet\Install-Package EasyCaptchaCore -Version 1.0.0
<PackageReference Include="EasyCaptchaCore" Version="1.0.0" />
paket add EasyCaptchaCore --version 1.0.0
#r "nuget: EasyCaptchaCore, 1.0.0"
// Install EasyCaptchaCore as a Cake Addin #addin nuget:?package=EasyCaptchaCore&version=1.0.0 // Install EasyCaptchaCore as a Cake Tool #tool nuget:?package=EasyCaptchaCore&version=1.0.0
Easy Captcha
An efficient and secured alternative of Google reCAPTCHA for ASP.NET Core and ASP.NET MVC which has been written with C#. If you are being tired of struggling with Google reCAPTCHA and also worried about performance and banning issue with it, just take a minute to go through it for your consideration. I am certain that you won't be regret.
How to use
Install it from
Nuget
:Install-Package EasyCaptchaCore -Version 1.0.0
Add
ICaptchaService
to yourStatrup
like this:services.AddTransient<ICaptchaService, CaptchaService>();
Enable
Session
inConfigure
method like this:app.UseSession();
Enable session
IdleTimeout
in yourConfigureServices
If you are using.NET Core
orMVC
. You can change the session timeout if you want. It uses to store theCaptcha
in the user session securely.services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(10); });
Use the code below in your
View Layout
:<img src="~/Captcha" alt="Captcha" />
In order to randomly change the
Captcha
text by clicking on it, you can use the code below:<img src="~/Captcha" alt="Captcha" style="cursor: pointer;" onclick="refreshImage(this);" />
<script type="text/javascript"> refreshImage = function (img) { var source = img.src; img.src = ''; source = source.split('?')[0]; source = source + '?' + new Date().getTime(); img.src = source; } </script>
Use the code below to compare the real
Captcha
with the user input:[HttpPost] public ActionResult Index(CaptchaModel model) { var realCaptcha = HttpContext.Session.GetString("captcha").ToLower(); if (realCaptcha != model.Captcha) model.Message = "Ops...Wrong captcha!"; else model.Message = "Congrats! Captcha has been matched!"; return View(model); }
You can change the length of the captcha by the code below. (Default value is 5):
<img src="~/Captcha?l=6" alt="Captcha" />
You can change the background color of the captcha by the code below either by writting the color name or the keyword
random
. (Default istransparent
):<img src="~/Captcha?bc=black" alt="Captcha" />
<img src="~/Captcha?bc=random" alt="Captcha" />
You can change the forecolor of the captcha by the code below either by writting the color name or the keyword
random
. (Default israndom
):<img src="~/Captcha?fc=green" alt="Captcha" />
You can change type of the characters.
num
for numeric characters ormix
for mixed characters. (Default ismix
):<img src="~/Captcha?t=num" alt="Captcha" />
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
net5.0
- System.Drawing.Common (>= 5.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.