EasyCaptchaCore 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EasyCaptchaCore --version 1.0.0
NuGet\Install-Package EasyCaptchaCore -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="EasyCaptchaCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyCaptchaCore --version 1.0.0
#r "nuget: EasyCaptchaCore, 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.
// 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.

c1 c2 c3 c4 c5 c6 c7 c8 c9 c10

How to use

  • Install it from Nuget:

    Install-Package EasyCaptchaCore -Version 1.0.0
    
  • Add ICaptchaService to your Statrup like this:

    services.AddTransient<ICaptchaService, CaptchaService>();
    
  • Enable Session in Configure method like this:

    app.UseSession();
    
  • Enable session IdleTimeout in your ConfigureServices If you are using .NET Core or MVC. You can change the session timeout if you want. It uses to store the Captcha 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 is transparent):

    <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 is random):

    <img src="~/Captcha?fc=green" alt="Captcha" />
    
  • You can change type of the characters. num for numeric characters or mix for mixed characters. (Default is mix):

    <img src="~/Captcha?t=num" alt="Captcha" />
    
Product 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. 
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.1 196 7/18/2023
1.0.0 585 1/15/2022