xsoheilalizadeh / reCaptcha.Google.Mvc

The Google reCaptcha For ASP.NET MVC Web Apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reCaptcha.Google.Mvc

Install Nuget Package:

Install-Package reCaptcha.Google.Mvc

Documention

Configure Captcha

In Global.asax file and Application_Start method you can config Google reCaptcha:

GoogleCaptchaConfiguration.Register(new GoogleCaptchaConfig(CaptchaTheme.Light)
{
    EnableInDebuggingMode = false,
    Secretkey = "yourSecretkey",
    Sitekey = "yourSitekey",
});

Usage

To render Captcha use Html.RenderCaptcha():

@Html.RenderCaptcha()
@Html.RenderCaptcha("siteKey") // also you set Sitekey here

To render Captcha script use Html.RenderCaptchaScript():

@Html.RenderCaptchaScript()

To validation request use GoogleCaptcha on the action method:

[HttpPost]
[Route("sign-up")]
[GoogleCaptcha]
public ActionResult Register()
{
    // more code
}

About

The Google reCaptcha For ASP.NET MVC Web Apps

License:Apache License 2.0


Languages

Language:C# 100.0%