I have reCaptcha installation problems. I already saw some posts about that, even in StackOverflow but it didn't help me to get it working.
I followed this post, and this post but in this line:
@using Microsoft.Web.Helpers
I get the message:
The type or namespace name 'Helpers' does not exist in the namespace 'Microsoft.Web' (are you missing an assembly reference?)
I added all references mentioned, all assemblies in both web.config files (root and view folder), restarted VS2010, updated the MVC3 package, included WebMatrix packages but I couldn't get it working.
I guess it should be simple to install, but I don't know what I'm doing wrong.
Anyone could help me?
Here's a step by step guide:
- Create a new ASP.NET MVC 3 project using the default template
- Install the
microsoft-web-helpers
NuGet In the
Index.cshtml
view ofHomeController
create a form and bring theMicrosoft.Web.Helpers
namespace into scope:@using Microsoft.Web.Helpers @using (Html.BeginForm()) { @ReCaptcha.GetHtml(publicKey: "__ put your public key here __") <button type="submit">OK</button> }
And to validate the Captcha in the controller:
[HttpPost] public ActionResult Index(MyViewModel model) { if (!ReCaptcha.Validate(privateKey: "__ put your private key here __")) { return View(model); } return RedirectToAction("success"); }
来源:https://stackoverflow.com/questions/8276354/recaptcha-and-mvc3-problems-getting-microsoft-web-helpers-working