Skip to content

Instantly share code, notes, and snippets.

@MoienTajik
Created February 17, 2018 13:03
Show Gist options
  • Save MoienTajik/54849fbeb1efb719e59a2f8698485e5e to your computer and use it in GitHub Desktop.
Save MoienTajik/54849fbeb1efb719e59a2f8698485e5e to your computer and use it in GitHub Desktop.
Using Google reCAPTCHA in ASP.NET MVC - Create View
@using GoogleRecaptcha.Infrastructure.HtmlHelpers
@{
ViewBag.Title = "Create";
}
<h2>@ViewBag.Title</h2>
<h4>Some test form that needs reCAPTCHA !</h4>
<hr />
@using (Html.BeginForm("Create", "Test", FormMethod.Post, new { @class = "form-horizontal" }))
{
@Html.AntiForgeryToken()
<div class="form-group">
@Html.Label("Title", new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBox("Title", "", new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
@Html.GoogleCaptcha()
@Html.InvalidGoogleCaptchaLabel("Captcha is not valid !")
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment