mercredi 22 juillet 2015

null entry for parameter 'captchaValid'

I have an old site over MVC 3 wich was working fine, but our server crashed last week, now i've recovered it but reCaptcha in the forms started giving problems it didn't have before.

On my local machine it works fine but on production server, where everything is set in the same way, it yells System.ArgumentException: The parameters dictionary contains a null entry for parameter 'captchaValid' of non-nullable type 'System.Boolean'

I believe everything should be ok

[web.config]

<appSettings>
    <add key="webpages:Version" value="1.0.0.0"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    <add key="ReCaptchaPrivateKey" value="MyPrivateKey" />
    <add key="ReCaptchaPublicKey" value="MyPublicKey" />
</appSettings>
(...)
<namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="Recaptcha"/>
</namespaces>

[reCaptcha on View]

<script type="text/javascript">
    var RecaptchaOptions = {
        theme: 'custom',
        custom_theme_widget: 'recaptcha_widget'
    };
</script>

<div id="recaptcha_widget" style="display:none">

    <div style="float:left;">
        <div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>

        <span class="recaptcha_only_if_image"><label for="recaptcha_response_field">Insira as palavras que vê na imagem</label></span>
        <span class="recaptcha_only_if_audio">Enter<label for="recaptcha_response_field">Insira os números que ouve</label></span>

        <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
    </div>

    <div style="float:right;">
        <div style="float: left;">
            <div id="recaptcha_image"></div>
        </div>
        <div style="float: left; margin-left: 30xp;">
            <div><a href="javascript:Recaptcha.reload()" class="recaptcha-btn"><i class="icon-refresh"></i></a></div>
            <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')" class="recaptcha-btn"><i class="icon-volume-up"></i></a></div>
            <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')" class="recaptcha-btn"><i class="icon-font"></i></a></div>
            <div><a href="javascript:Recaptcha.showhelp()" class="recaptcha-btn"><i class="icon-question-sign"></i></a></div> 
        </div>
        <div class="clear"></div>
    </div>

</div>

<script type="text/javascript" src="http://ift.tt/1HJpC9Y"></script>
<noscript>
    <iframe src="http://ift.tt/1HJpCa0" height="300" width="500" frameborder="0"></iframe><br>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>

[in the controller]

[HttpPost]
[Recaptcha.RecaptchaControlMvc.CaptchaValidator]
public JsonResult Enviar(RegisterModel model, bool captchaValid, string captchaErrorMessage)
{
    (...)
}

I belive that Recaptcha.RecaptchaControlMvc.CaptchaValidator should be the one responsible for generating values for captchaValid but this is not working outside my development machine.

Does anybody have any idea why does this is happening?

Aucun commentaire:

Enregistrer un commentaire