1

The MvcReCaptcha library looks very solid, and appears to have some good developer adoption, but when I tried it for the first time today, using the supplied HTML helper, my app won't run. I have the helper in a partial view as follows:

<fieldset>
    <legend>3. Verify that you are a human.</legend>
        @Html.GenerateCaptcha()
</fieldset>

I have the namespace included in web.config as instructed:

<pages>
    <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="MvcReCaptcha.Helpers"/>
    </namespaces>
</pages>

(Other namespaces removed for brevity)

And I have my private and public keys defined in appSettings. I can see no way that I deviate from the examples on the CodePlex page except that I am using Razor. Can anyone offer some insight into what I may be doing wrong?

ProfK
  • 49,207
  • 121
  • 399
  • 775

1 Answers1

0

If you are using Razor you need to add the MvcReCaptcha.Helpers namespace to the <namespaces> section of ~/Views/web.config file and not the one in ~/web.config.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • that has 90% fixed the problem. The helper is now rendering, but it is rendering literal script, i.e. the script is html encoded. I had to wrap the GenerateCaptcha in Html.Raw(). – ProfK Apr 17 '11 at 15:45